Apache Lucene open-source search software
LUCENE-6069: Lucene Core now gets compiled with Java 8 "compact1" profile, all other modules with "compact2".
Uwe Schindler0f7b913b07a2
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txtindex f0acfbfe478..92901d284b7 100644--- a/lucene/CHANGES.txt+++ b/lucene/CHANGES.txt@@ -10,6 +10,9 @@ System Requirements* LUCENE-5950: Move to Java 8 as minimum Java version.(Ryan Ernst, Uwe Schindler)+* LUCENE-6069: Lucene Core now gets compiled with Java 8 "compact1" profile,+ all other modules with "compact2". (Robert Muir, Uwe Schindler)+New Features* LUCENE-5735: NumberRangePrefixTreeStrategy now includes interval/range facetingdiff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 4e2d44fb52b..cdf059eb433 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -165,6 +165,7 @@<property name="javac.source" value="1.8"/><property name="javac.target" value="1.8"/><property name="javac.args" value="-Xlint -Xlint:-deprecation -Xlint:-serial -Xlint:-options"/>+ <property name="javac.profile.args" value="-profile compact2"/><property name="javadoc.link" value="http://download.oracle.com/javase/8/docs/api/"/><property name="javadoc.link.junit" value="http://junit.sourceforge.net/javadoc/"/><property name="javadoc.packagelist.dir" location="${common.dir}/tools/javadoc"/>@@ -1861,8 +1862,8 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}<nested/><!-- <compilerarg line="-Xmaxwarns 10000000"/><compilerarg line="-Xmaxerrs 10000000"/> -->- <!-- for generics in Java 1.5: --><compilerarg line="${javac.args}"/>+ <compilerarg line="${javac.profile.args}"/><compilerarg line="${javac.doclint.args}"/></javac></sequential>diff --git a/lucene/core/build.xml b/lucene/core/build.xmlindex 10ef2056407..19e571e2d68 100644--- a/lucene/core/build.xml+++ b/lucene/core/build.xml@@ -35,6 +35,8 @@org/apache/lucene/index/TestIndexWriterOnJRECrash.class"/>+ <!-- lucene core can use the minimal JDK profile -->+ <property name="javac.profile.args" value="-profile compact1"/><import file="../common-build.xml"/><property name="moman.commit-hash" value="5c5c2a1e4dea" />diff --git a/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java b/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.javaindex 95e98060fd8..87ee1487e92 100644--- a/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java+++ b/lucene/core/src/test/org/apache/lucene/util/StressRamUsageEstimator.java@@ -17,17 +17,7 @@ package org.apache.lucene.util;* limitations under the License.*/-import java.lang.management.GarbageCollectorMXBean;-import java.lang.management.ManagementFactory;-import java.lang.management.MemoryMXBean;-import java.lang.management.MemoryUsage;-import java.util.ArrayList;import java.util.Arrays;-import java.util.List;-import java.util.Locale;-import java.util.Random;--import org.junit.Ignore;/*** Estimates how {@link RamUsageEstimator} estimates physical memory consumption@@ -47,45 +37,19 @@ public class StressRamUsageEstimator extends LuceneTestCase {}}- // This shows an easy stack overflow because we're counting recursively.- @Ignore- public void testChainedEstimation() {- MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();-- Random rnd = random();- Entry first = new Entry();- try {- while (true) {- // Check the current memory consumption and provide the estimate.- long jvmUsed = memoryMXBean.getHeapMemoryUsage().getUsed();- long estimated = RamUsageTester.sizeOf(first);- System.out.println(String.format(Locale.ROOT, "%10d, %10d",- jvmUsed, estimated));-- // Make a batch of objects.- for (int i = 0; i < 5000; i++) {- first.createNext(new byte[rnd.nextInt(1024)]);- }- }- } catch (OutOfMemoryError e) {- // Release and quit.- }- }-volatile Object guard;// This shows an easy stack overflow because we're counting recursively.public void testLargeSetOfByteArrays() {- MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();- causeGc();- long before = memoryMXBean.getHeapMemoryUsage().getUsed();+ System.gc();+ long before = Runtime.getRuntime().totalMemory();Object [] all = new Object [1000000];for (int i = 0; i < all.length; i++) {all[i] = new byte[random().nextInt(3)];}- causeGc();- long after = memoryMXBean.getHeapMemoryUsage().getUsed();+ System.gc();+ long after = Runtime.getRuntime().totalMemory();System.out.println("mx: " + RamUsageEstimator.humanReadableUnits(after - before));System.out.println("rue: " + RamUsageEstimator.humanReadableUnits(shallowSizeOf(all)));@@ -112,24 +76,16 @@ public class StressRamUsageEstimator extends LuceneTestCase {}public void testSimpleByteArrays() {- MemoryMXBean memoryMXBean = ManagementFactory.getMemoryMXBean();-Object [][] all = new Object [0][];try {while (true) {// Check the current memory consumption and provide the estimate.- causeGc();- MemoryUsage mu = memoryMXBean.getHeapMemoryUsage();+ System.gc();long estimated = shallowSizeOf(all);if (estimated > 50 * RamUsageEstimator.ONE_MB) {break;}- System.out.println(String.format(Locale.ROOT, "%10s\t%10s\t%10s",- RamUsageEstimator.humanReadableUnits(mu.getUsed()),- RamUsageEstimator.humanReadableUnits(mu.getMax()),- RamUsageEstimator.humanReadableUnits(estimated)));-// Make another batch of objects.Object[] seg = new Object[10000];all = Arrays.copyOf(all, all.length + 1);@@ -142,24 +98,4 @@ public class StressRamUsageEstimator extends LuceneTestCase {// Release and quit.}}-- /**- * Very hacky, very crude, but (sometimes) works.- * Don't look, it will burn your eyes out.- */- private void causeGc() {- List<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory.getGarbageCollectorMXBeans();- List<Long> ccounts = new ArrayList<>();- for (GarbageCollectorMXBean g : garbageCollectorMXBeans) {- ccounts.add(g.getCollectionCount());- }- List<Long> ccounts2 = new ArrayList<>();- do {- System.gc();- ccounts.clear();- for (GarbageCollectorMXBean g : garbageCollectorMXBeans) {- ccounts2.add(g.getCollectionCount());- }- } while (ccounts2.equals(ccounts));- }}diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/spans/TestSpanQueryParserSimpleSample.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/spans/TestSpanQueryParserSimpleSample.javaindex 4d64b2bc501..11a784ace2f 100644--- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/spans/TestSpanQueryParserSimpleSample.java+++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/spans/TestSpanQueryParserSimpleSample.java@@ -17,14 +17,13 @@ package org.apache.lucene.queryparser.flexible.spans;* limitations under the License.*/-import javax.management.Query;-import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler;import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode;import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;import org.apache.lucene.queryparser.flexible.core.parser.SyntaxParser;import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorPipeline;import org.apache.lucene.queryparser.flexible.standard.parser.StandardSyntaxParser;+import org.apache.lucene.search.Query;import org.apache.lucene.search.spans.SpanQuery;import org.apache.lucene.search.spans.SpanTermQuery;import org.apache.lucene.util.LuceneTestCase;diff --git a/solr/common-build.xml b/solr/common-build.xmlindex f5b5fd5a9a5..abe8fed401b 100644--- a/solr/common-build.xml+++ b/solr/common-build.xml@@ -29,6 +29,7 @@<property name="javac.source" value="1.8"/><property name="javac.target" value="1.8"/><property name="javac.args" value=""/>+ <property name="javac.profile.args" value=""/><property name="dest" location="${common-solr.dir}/build" /><property name="build.dir" location="${dest}/${ant.project.name}"/>