Releng: update to and build against I20160511-2000 for 4.6RC1
diff --git a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
index 49bb4fb..3e6c2b3 100644
--- a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
+++ b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
@@ -59,7 +59,7 @@
</url>
<requires>
- <import feature="org.eclipse.jdt" version="3.12.0.v20160428-0800" patch="true"/>
+ <import feature="org.eclipse.jdt" version="3.12.0.v20160511-2000" patch="true"/>
</requires>
<plugin
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index 3c5e188..e48c923 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -55,9 +55,14 @@
import org.eclipse.jdt.core.compiler.CompilationProgress;
import org.eclipse.jdt.core.compiler.batch.BatchCompiler;
import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.compiler.batch.ClasspathDirectory;
import org.eclipse.jdt.internal.compiler.batch.ClasspathJar;
import org.eclipse.jdt.internal.compiler.batch.ClasspathLocation;
+import org.eclipse.jdt.internal.compiler.batch.FileSystem;
import org.eclipse.jdt.internal.compiler.batch.Main;
+import org.eclipse.jdt.internal.compiler.batch.FileSystem.Classpath;
+import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
import org.eclipse.jdt.internal.compiler.util.ManifestAnalyzer;
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -14630,4 +14635,42 @@
"1 problem (1 warning)\n",
true);
}
+
+/**
+ * A fast exit/result is expected when secondary types are searched with the reserved class name "package-info",
+ * because there can not exist a secondary type with the name "package-info", because it is a reserved class name.
+ * This fast exit improves the performance, because the search for secondary types is very expensive regarding performance
+ * (all classes of a package have to get loaded, parsed and analyzed).
+ */
+public void testFileSystem_findSecondaryInClass() {
+ final String testScratchArea = "fileSystemTestScratchArea";
+
+ File testScratchAreaFile = new File(Util.getOutputDirectory(), testScratchArea);
+ try {
+ if(!testScratchAreaFile.exists()) {
+ testScratchAreaFile.mkdirs();
+ }
+
+ assertTrue(testScratchAreaFile.exists());
+
+ Classpath classpath = FileSystem.getClasspath(testScratchAreaFile.getPath(), null, null);
+ assertNotNull(classpath);
+ assertTrue(classpath instanceof ClasspathDirectory);
+
+ ClasspathDirectory classpathDirectory = (ClasspathDirectory)classpath;
+ NameEnvironmentAnswer answer = classpathDirectory.findSecondaryInClass(TypeConstants.PACKAGE_INFO_NAME, null, null);
+ assertNull(answer); //No answer is expected, because "package-info" isn't a secondary type.
+
+ try {
+ //When there is a call with another name like "package-info", an exception is expected, because the search can not get executed successfully
+ // when no value for qualifiedPackageName is provided.
+ classpathDirectory.findSecondaryInClass("X".toCharArray(), null, null);
+ fail("An exception is expected, because the parameter qualifiedPackageName can not be NULL!");
+ } catch(Exception e) {}
+ } finally {
+ if(testScratchAreaFile.exists()) {
+ Util.delete(testScratchAreaFile);
+ }
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index ce25d2c..33c9afd 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -52197,4 +52197,36 @@
customOptions);
}
}
+public void testBug492450_comment0() {
+ if (this.complianceLevel >= ClassFileConstants.JDK1_6) {
+ runConformTest(
+ new String[] {
+ "DocumentObject.java",
+ "\n" +
+ "import java.util.ArrayList;\n" +
+ "\n" +
+ "interface IDocumentElementNode {\n" +
+ " public ArrayList<?> getChildNodesList();\n" +
+ "}\n" +
+ "\n" +
+ "abstract class DocumentElementNode implements IDocumentElementNode {\n" +
+ " @Override\n" +
+ " public ArrayList<IDocumentElementNode> getChildNodesList() {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "interface IDocumentObject extends IDocumentElementNode {\n" +
+ " public ArrayList<?> getChildNodesList(Class<?>[] classes, boolean match);\n" +
+ "}\n" +
+ "\n" +
+ "public abstract class DocumentObject extends DocumentElementNode implements IDocumentObject {\n" +
+ " @Override\n" +
+ " public ArrayList<IDocumentElementNode> getChildNodesList(Class<?>[] classes, boolean match) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n"
+ });
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
index 6406ce2..845f636 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java
@@ -6237,4 +6237,164 @@
"The method copyToValueObject(Java8TypeInferenceProblem.BusinessObject, Class<Java8TypeInferenceProblem.ValueObjectImpl>) is ambiguous for the type Java8TypeInferenceProblem\n" +
"----------\n");
}
+public void testBug492939a() {
+ runConformTest(
+ new String[] {
+ "EclipseInference.java",
+ "import java.lang.reflect.Type;\n" +
+ "import java.sql.ResultSet;\n" +
+ "import java.sql.SQLException;\n" +
+ "import java.util.List;\n" +
+ "import java.util.Optional;\n" +
+ "import java.util.concurrent.ConcurrentHashMap;\n" +
+ "import java.util.concurrent.CopyOnWriteArrayList;\n" +
+ "import java.util.function.Supplier;\n" +
+ "import java.util.stream.Stream;\n" +
+ "\n" +
+ "public class EclipseInference {\n" +
+ "\n" +
+ " private final List<RowMapperFactory> rowFactories = new CopyOnWriteArrayList<>();\n" +
+ " private final ConcurrentHashMap<Type, RowMapper<?>> rowCache = new ConcurrentHashMap<>();\n" +
+ "\n" +
+ " @SuppressWarnings(\"unchecked\")\n" +
+ " public Optional<RowMapper<?>> findRowMapperFor(Type type) {\n" +
+ " return Optional.ofNullable(rowCache.computeIfAbsent(type, t ->\n" +
+ " findFirstPresent(\n" +
+ " () -> rowFactories.stream()\n" +
+ " .flatMap(factory -> toStream(factory.build(t)))\n" +
+ " .findFirst(),\n" +
+ " () -> findColumnMapperFor(t)\n" +
+ " .map(SingleColumnMapper::new))\n" + // HERE: ReferenceExpression had a bug
+ " .orElse(null)));\n" +
+ " }\n" +
+ "\n" +
+ " private Optional<ColumnMapper<?>> findColumnMapperFor(Type t) {\n" +
+ " return Optional.empty();\n" +
+ " }\n" +
+ "\n" +
+ " @SafeVarargs\n" +
+ " static <T> Optional<T> findFirstPresent(Supplier<Optional<T>>... suppliers) {\n" +
+ " return Stream.of(suppliers)\n" +
+ " .flatMap(supplier -> toStream(supplier.get()))\n" +
+ " .findFirst();\n" +
+ " }\n" +
+ " static <T> Stream<T> toStream(Optional<T> optional) {\n" +
+ " return optional.isPresent() ? Stream.of(optional.get()) : Stream.empty();\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class SingleColumnMapper<T> implements RowMapper<T> {\n" +
+ " SingleColumnMapper(ColumnMapper<T> mapper) {\n" +
+ " }\n" +
+ " @Override\n" +
+ " public T map(ResultSet r) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface RowMapper<T>\n" +
+ "{\n" +
+ " T map(ResultSet r);\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface ColumnMapper<T>\n" +
+ "{\n" +
+ " T map(ResultSet r, int columnNumber) throws SQLException;\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface RowMapperFactory\n" +
+ "{\n" +
+ " Optional<RowMapper<?>> build(Type type);\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface ColumnMapperFactory\n" +
+ "{\n" +
+ " Optional<ColumnMapper<?>> build(Type type);\n" +
+ "}\n"
+ });
+}
+public void testBug492939b() {
+ runConformTest(
+ new String[] {
+ "EclipseInference.java",
+ "import java.lang.reflect.Type;\n" +
+ "import java.sql.ResultSet;\n" +
+ "import java.sql.SQLException;\n" +
+ "import java.util.List;\n" +
+ "import java.util.Optional;\n" +
+ "import java.util.concurrent.ConcurrentHashMap;\n" +
+ "import java.util.concurrent.CopyOnWriteArrayList;\n" +
+ "import java.util.function.Supplier;\n" +
+ "import java.util.stream.Stream;\n" +
+ "\n" +
+ "public class EclipseInference {\n" +
+ "\n" +
+ " private final List<RowMapperFactory> rowFactories = new CopyOnWriteArrayList<>();\n" +
+ " private final ConcurrentHashMap<Type, RowMapper<?>> rowCache = new ConcurrentHashMap<>();\n" +
+ "\n" +
+ " @SuppressWarnings(\"unchecked\")\n" +
+ " public Optional<RowMapper<?>> findRowMapperFor(Type type) {\n" +
+ " return Optional.ofNullable(rowCache.computeIfAbsent(type, t ->\n" +
+ " findFirstPresent(\n" +
+ " () -> rowFactories.stream()\n" +
+ " .flatMap(factory -> toStream(factory.build(t)))\n" +
+ " .findFirst(),\n" +
+ " () -> findColumnMapperFor(t)\n" +
+ " .map(c -> new SingleColumnMapper<>(c)))\n" + // HERE: LambdaExpression already worked
+ " .orElse(null)));\n" +
+ " }\n" +
+ "\n" +
+ " private Optional<ColumnMapper<?>> findColumnMapperFor(Type t) {\n" +
+ " return Optional.empty();\n" +
+ " }\n" +
+ "\n" +
+ " @SafeVarargs\n" +
+ " static <T> Optional<T> findFirstPresent(Supplier<Optional<T>>... suppliers) {\n" +
+ " return Stream.of(suppliers)\n" +
+ " .flatMap(supplier -> toStream(supplier.get()))\n" +
+ " .findFirst();\n" +
+ " }\n" +
+ " static <T> Stream<T> toStream(Optional<T> optional) {\n" +
+ " return optional.isPresent() ? Stream.of(optional.get()) : Stream.empty();\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class SingleColumnMapper<T> implements RowMapper<T> {\n" +
+ " SingleColumnMapper(ColumnMapper<T> mapper) {\n" +
+ " }\n" +
+ " @Override\n" +
+ " public T map(ResultSet r) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface RowMapper<T>\n" +
+ "{\n" +
+ " T map(ResultSet r);\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface ColumnMapper<T>\n" +
+ "{\n" +
+ " T map(ResultSet r, int columnNumber) throws SQLException;\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface RowMapperFactory\n" +
+ "{\n" +
+ " Optional<RowMapper<?>> build(Type type);\n" +
+ "}\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "interface ColumnMapperFactory\n" +
+ "{\n" +
+ " Optional<ColumnMapper<?>> build(Type type);\n" +
+ "}\n"
+ });
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
index 1eee4a4..6640f53 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
@@ -12226,4 +12226,32 @@
"----------\n"
);
}
+public void testBug492327() {
+ runConformTestWithLibs(
+ new String[] {
+ "WatchEvent.java",
+ "public interface WatchEvent<T> {\n" +
+ " public static interface Modifier {\n" +
+ " }\n" +
+ "}\n",
+ "Watchable.java",
+ "public interface Watchable {\n" +
+ " void register(WatchEvent.Modifier[] modifiers);\n" +
+ "}\n",
+ },
+ getCompilerOptions(),
+ ""
+ );
+ runConformTestWithLibs(
+ new String[] {
+ "Path.java",
+ "public interface Path extends Watchable {\n" +
+ " @Override\n" +
+ " void register(WatchEvent.Modifier[] modifiers);\n" +
+ "}\n",
+ },
+ getCompilerOptions(),
+ ""
+ );
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PackageBindingTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PackageBindingTest.java
new file mode 100644
index 0000000..827e53d
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PackageBindingTest.java
@@ -0,0 +1,161 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Sven Strohschein and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Sven Strohschein - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.lookup.Binding;
+import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment;
+import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
+import org.eclipse.jdt.internal.core.INameEnvironmentWithProgress;
+
+public class PackageBindingTest extends AbstractCompilerTest
+{
+ public PackageBindingTest(String name) {
+ super(name);
+ }
+
+ /**
+ * This test checks if it is searched for packages before searching for types.
+ * The search for packages is much faster than searching for types, therefore it should get executed before searching for types.
+ */
+ public void test01() {
+ NameEnvironmentDummy nameEnv = new NameEnvironmentDummy(true);
+
+ PackageBinding packageBinding = new PackageBinding(new LookupEnvironment(null, new CompilerOptions(), null, nameEnv));
+ Binding resultBinding = packageBinding.getTypeOrPackage("java.lang".toCharArray());
+ assertNotNull(resultBinding);
+
+ assertTrue(nameEnv.isPackageSearchExecuted);
+ assertFalse(nameEnv.isTypeSearchExecuted);
+ }
+
+ /**
+ * This test checks if it is searched for types when no package was found.
+ * The test {@link #test01()} checks if the package search is executed before the type search.
+ * The search for packages is much faster than searching for types, therefore it should get executed before searching for types.
+ */
+ public void test02() {
+ NameEnvironmentDummy nameEnv = new NameEnvironmentDummy(false);
+
+ PackageBinding packageBinding = new PackageBinding(new LookupEnvironment(null, new CompilerOptions(), null, nameEnv));
+ Binding resultBinding = packageBinding.getTypeOrPackage("java.lang.String".toCharArray());
+ assertNull(resultBinding); // (not implemented)
+
+ assertTrue(nameEnv.isPackageSearchExecuted);
+ assertTrue(nameEnv.isTypeSearchExecuted);
+ }
+
+ /**
+ * This test checks if {@link INameEnvironment#findType(char[], char[][])} is executed.
+ * INameEnvironment has no option to avoid the search for secondary types, therefore the search for secondary types is executed (when available).
+ */
+ public void test03() {
+ NameEnvironmentDummy nameEnv = new NameEnvironmentDummy(false);
+
+ LookupEnvironment lookupEnv = new LookupEnvironment(null, new CompilerOptions(), null, nameEnv);
+ PackageBinding packageBinding = lookupEnv.createPackage(new char[][]{"org/eclipse/jdt".toCharArray(), "org/eclipse/jdt/internal".toCharArray()});
+ assertNotNull(packageBinding);
+
+ assertTrue(nameEnv.isTypeSearchExecuted); //the method findType(char[], char[][]) should got executed (without an option to avoid the search for secondary types)
+ }
+
+ /**
+ * This test checks if types are searched on creating a package, but without the search for secondary types.
+ * It isn't necessary to search for secondary types when creating a package, because a package name can not collide with a secondary type.
+ * The search for secondary types should not get executed, because the search for secondary types is very expensive regarding performance
+ * (all classes of a package have to get loaded, parsed and analyzed).
+ */
+ public void test04() {
+ NameEnvironmentWithProgressDummy nameEnvWithProgress = new NameEnvironmentWithProgressDummy();
+
+ LookupEnvironment lookupEnv = new LookupEnvironment(null, new CompilerOptions(), null, nameEnvWithProgress);
+ PackageBinding packageBinding = lookupEnv.createPackage(new char[][]{"org/eclipse/jdt".toCharArray(), "org/eclipse/jdt/internal".toCharArray()});
+ assertNotNull(packageBinding);
+
+ assertTrue(nameEnvWithProgress.isTypeSearchExecutedWithSearchWithSecondaryTypes); //the method findType(char[], char[][], boolean) should got executed ...
+ assertFalse(nameEnvWithProgress.isTypeSearchWithSearchWithSecondaryTypes); //... but without the search for secondary types
+ }
+
+ private class NameEnvironmentDummy implements INameEnvironment
+ {
+ private final boolean isPackage;
+ boolean isPackageSearchExecuted;
+ boolean isTypeSearchExecuted;
+
+ NameEnvironmentDummy(boolean isPackage) {
+ this.isPackage = isPackage;
+ }
+
+ @Override
+ public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
+ this.isTypeSearchExecuted = true;
+ return null;
+ }
+
+ @Override
+ public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
+ this.isTypeSearchExecuted = true;
+ return null;
+ }
+
+ @Override
+ public boolean isPackage(char[][] parentPackageName, char[] packageName) {
+ this.isPackageSearchExecuted = true;
+ return this.isPackage;
+ }
+
+ @Override
+ public void cleanup() {
+ }
+ }
+
+ private class NameEnvironmentWithProgressDummy implements INameEnvironmentWithProgress
+ {
+ boolean isTypeSearchWithSearchWithSecondaryTypes;
+ boolean isTypeSearchExecutedWithSearchWithSecondaryTypes;
+
+ NameEnvironmentWithProgressDummy() {}
+
+ @Override
+ public NameEnvironmentAnswer findType(char[][] compoundTypeName) {
+ return null;
+ }
+
+ @Override
+ public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName) {
+ return null;
+ }
+
+ @Override
+ public boolean isPackage(char[][] parentPackageName, char[] packageName) {
+ return false;
+ }
+
+ @Override
+ public void cleanup() {
+ }
+
+ @Override
+ public void setMonitor(IProgressMonitor monitor) {
+ }
+
+ @Override
+ public NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes) {
+ this.isTypeSearchExecutedWithSearchWithSecondaryTypes = true;
+ this.isTypeSearchWithSearchWithSecondaryTypes = searchWithSecondaryTypes;
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index c37bce6..c5afbf4 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,6 +91,7 @@
standardTests.add(ManifestAnalyzerTest.class);
standardTests.add(InitializationTests.class);
standardTests.add(ResourceLeakTests.class);
+ standardTests.add(PackageBindingTest.class);
// add all javadoc tests
for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) {
diff --git a/org.eclipse.jdt.core.tests.model/forceQualifierUpdate.txt b/org.eclipse.jdt.core.tests.model/forceQualifierUpdate.txt
new file mode 100644
index 0000000..df0d3fd
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update, add the bug here
+Bug 489604 - should not override <timestampProvider>
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index 8349d07..30eb075 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -30,14 +30,6 @@
<build>
<plugins>
<plugin>
- <groupId>org.eclipse.tycho</groupId>
- <artifactId>tycho-packaging-plugin</artifactId>
- <version>${tycho.version}</version>
- <configuration>
- <format>'v${buildTimestamp}'</format>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho.version}</version>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
index d3f5ca1..f727e3f 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
@@ -12443,4 +12443,19 @@
"}";
formatSource(source);
}
+/**
+ * https://bugs.eclipse.org/492735 - [formatter] Excessive wrapping in a complex expression
+ */
+public void testBug492735() {
+ this.formatterPrefs.alignment_for_assignment = Alignment.M_COMPACT_SPLIT;
+ this.formatterPrefs.page_width = 60;
+ String source =
+ "class FormatterIssue {\r\n" +
+ " String[] S = new String[] {\r\n" +
+ " foo(\"first line xxxxxxxxxxx\", \"y\", \"z\"),\r\n" +
+ " foo(\"second line xxxxxxxxxxxxxxxxxxx\", \"b\",\r\n" +
+ " \"c\"), };\r\n" +
+ "}";
+ formatSource(source);
+}
}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
index 1eb8eae..96bb041 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java
@@ -209,6 +209,7 @@
if (f.isDirectory()) continue;
String s = f.getAbsolutePath();
if (s == null) continue;
+ if (!(s.endsWith(SUFFIX_STRING_java) || s.endsWith(SUFFIX_STRING_JAVA))) continue;
CompilationUnit cu = new CompilationUnit(null, s, this.encoding, this.destinationPath);
CompilationResult compilationResult = new CompilationResult(cu.getContents(), 1, 1, 10);
ProblemReporter problemReporter =
@@ -217,6 +218,7 @@
new CompilerOptions(this.options),
new DefaultProblemFactory());
Parser parser = new Parser(problemReporter, false);
+ parser.reportSyntaxErrorIsRequired = false;
CompilationUnitDeclaration unit = parser.parse(cu, compilationResult);
org.eclipse.jdt.internal.compiler.ast.TypeDeclaration[] types = unit != null ? unit.types : null;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java
new file mode 100644
index 0000000..4dc4972
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2016 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.env;
+
+/**
+ * The name environment provides a callback API that the compiler
+ * can use to look up types, compilation units, and packages in the
+ * current environment. The name environment is passed to the compiler
+ * on creation.
+ *
+ * This name environment adds a method to switch on/off the search for secondary types.
+ * Refer {@link #findType(char[], char[][], boolean)}.
+ *
+ */
+public interface INameEnvironmentExtension extends INameEnvironment {
+ /**
+ * Find a type named <typeName> in the package <packageName>.
+ * Answer the binary form of the type if it is known to be consistent.
+ * Otherwise, answer the compilation unit which defines the type
+ * or null if the type does not exist.
+ * The default package is indicated by char[0][].
+ *
+ * It is known that the package containing the type exists.
+ *
+ * NOTE: This method can be used to find a member type using its
+ * internal name A$B, but the source file for A is answered if the binary
+ * file is inconsistent.
+ *
+ * The flag <searchWithSecondaryTypes> can be used to switch on/off the search for secondary types.
+ * This is useful because the search for secondary types may by very expensive regarding the performance
+ * and in many cases it isn't necessary to search for secondary types.
+ *
+ * @param typeName type to find
+ * @param packageName package of the searched type
+ * @param searchWithSecondaryTypes flag to switch on/off the search for secondary types
+ * @return {@link NameEnvironmentAnswer}
+ */
+ NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes);
+
+}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java
index 09ffa02..1b25cb3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java
@@ -288,13 +288,20 @@
// not checking r.mentionsAny for constructors, because A::new resolves to the raw type
// whereas in fact the type of all expressions of this shape depends on their type variable (if any)
{
- SuspendedInferenceRecord prevInvocation = inferenceContext.enterPolyInvocation(reference, reference.createPseudoExpressions(functionType.parameters));
+ TypeBinding[] argumentTypes;
+ if (t.isParameterizedType()) {
+ MethodBinding capturedFunctionType = ((ParameterizedTypeBinding)t).getSingleAbstractMethod(inferenceContext.scope, true, reference.sourceStart, reference.sourceEnd);
+ argumentTypes = capturedFunctionType.parameters;
+ } else {
+ argumentTypes = functionType.parameters;
+ }
+ SuspendedInferenceRecord prevInvocation = inferenceContext.enterPolyInvocation(reference, reference.createPseudoExpressions(argumentTypes));
// Invocation Applicability Inference: 18.5.1 & Invocation Type Inference: 18.5.2
try {
InferenceContext18 innerContex = reference.getInferenceContext((ParameterizedMethodBinding) compileTimeDecl);
int innerInferenceKind = innerContex != null ? innerContex.inferenceKind : InferenceContext18.CHECK_STRICT;
- inferInvocationApplicability(inferenceContext, original, functionType.parameters, original.isConstructor()/*mimic a diamond?*/, innerInferenceKind);
+ inferInvocationApplicability(inferenceContext, original, argumentTypes, original.isConstructor()/*mimic a diamond?*/, innerInferenceKind);
if (!inferPolyInvocationType(inferenceContext, reference, r, original))
return FALSE;
if (!original.isConstructor()
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index 4b75bc7..2d647dc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -59,7 +59,6 @@
import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
import org.eclipse.jdt.internal.compiler.util.HashtableOfPackage;
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
-import org.eclipse.jdt.internal.core.INameEnvironmentWithProgress;
import org.eclipse.objectteams.otdt.internal.core.compiler.control.Config;
import org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies;
import org.eclipse.objectteams.otdt.internal.core.compiler.control.ITranslationStates;
@@ -1016,11 +1015,11 @@
// catches the case of a package statement of: package java.lang.Object;
// since the package can be added after a set of source files have already been compiled,
// we need to check whenever a package is created
- if(this.nameEnvironment instanceof INameEnvironmentWithProgress) {
+ if(this.nameEnvironment instanceof INameEnvironmentExtension) {
//When the nameEnvironment is an instance of INameEnvironmentWithProgress, it can get avoided to search for secondaryTypes (see flag).
// This is a performance optimization, because it is very expensive to search for secondary types and it isn't necessary to check when creating a package,
// because package name can not collide with a secondary type name.
- if (((INameEnvironmentWithProgress)this.nameEnvironment).findType(compoundName[i], parent.compoundName, false) != null) {
+ if (((INameEnvironmentExtension)this.nameEnvironment).findType(compoundName[i], parent.compoundName, false) != null) {
return null;
}
} else {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
index 6a55264..d75edbf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
@@ -290,7 +290,8 @@
if (overridden != null) {
for (int i = overridden.length; --i >= 0;) {
MethodBinding inheritedMethod = overridden[i];
- if (areParametersEqual(currentMethod, inheritedMethod, this.environment) && !inheritedMethod.isStatic() && !inheritedMethod.isFinal())
+ if (isParameterSubsignature(currentMethod, inheritedMethod) &&
+ !inheritedMethod.isStatic() && !inheritedMethod.isFinal())
checkForBridgeMethod(currentMethod, inheritedMethod, allInheritedMethods);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
index 769e8f5..cc05839 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java
@@ -223,7 +223,7 @@
urb = (UnresolvedReferenceBinding) type;
ReferenceBinding resolvedType = urb.resolvedType;
if (resolvedType != null) {
- type = resolvedType;
+ type = this.environment.convertToRawType(resolvedType, false);
} else if (CharOperation.indexOf('$', type.sourceName()) > 0) {
boolean mayTolerateMissingType = this.environment.mayTolerateMissingType;
this.environment.mayTolerateMissingType = true;
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
index 16598b1..9783803 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java
@@ -559,7 +559,7 @@
WrapPolicy nextPolicy = this.tm.get(nextWrap.wrapTokenIndex).getWrapPolicy();
if (nextPolicy.wrapParentIndex == wrapPolicy.wrapParentIndex
|| (penaltyDiff != 0 && !wrapPolicy.isFirstInGroup)) {
- penalty -= penaltyDiff * 1.25;
+ penalty -= penaltyDiff * (1 + 1.0 / 64);
break;
}
if (nextPolicy.structureDepth <= wrapPolicy.structureDepth)
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
index df0b898..5ee63a6 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2014 IBM Corporation and others.
+ * Copyright (c) 2000, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -624,6 +624,8 @@
* The type signatures may be either unresolved (for source types)
* or resolved (for binary types), and either basic (for basic types)
* or rich (for parameterized types). See {@link Signature} for details.
+ * Note that the parameter type signatures for binary methods are expected
+ * to be dot-based.
* </p>
*
* @param name the given name
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
index 05588c4..79b615f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java
@@ -41,7 +41,7 @@
/**
* The parameter type signatures of the method - stored locally
* to perform equality test. <code>CharOperation.NO_STRINGS</code> indicates no
- * parameters.
+ * parameters. Note that the parameter type signatures are expected to be dot-based.
*/
protected String[] parameterTypes;
protected String [] erasedParamaterTypes; // lazily initialized via call to getErasedParameterTypes
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java
index 19fb615..303275b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java
@@ -11,8 +11,7 @@
package org.eclipse.jdt.internal.core;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
-import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironmentExtension;
/**
* The name environment provides a callback API that the compiler
@@ -25,7 +24,7 @@
*
* @since 3.6
*/
-public interface INameEnvironmentWithProgress extends INameEnvironment {
+public interface INameEnvironmentWithProgress extends INameEnvironmentExtension {
/**
* Set the monitor for the given name environment. In order to be able to cancel this name environment calls,
@@ -35,27 +34,4 @@
*/
void setMonitor(IProgressMonitor monitor);
- /**
- * Find a type named <typeName> in the package <packageName>.
- * Answer the binary form of the type if it is known to be consistent.
- * Otherwise, answer the compilation unit which defines the type
- * or null if the type does not exist.
- * The default package is indicated by char[0][].
- *
- * It is known that the package containing the type exists.
- *
- * NOTE: This method can be used to find a member type using its
- * internal name A$B, but the source file for A is answered if the binary
- * file is inconsistent.
- *
- * The flag <searchWithSecondaryTypes> can be used to switch on/off the search for secondary types.
- * This is useful because the search for secondary types may by very expensive regarding the performance
- * and in many cases it isn't necessary to search for secondary types.
- *
- * @param typeName type to find
- * @param packageName package of the searched type
- * @param searchWithSecondaryTypes flag to switch on/off the search for secondary types
- * @return {@link NameEnvironmentAnswer}
- */
- NameEnvironmentAnswer findType(char[] typeName, char[][] packageName, boolean searchWithSecondaryTypes);
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryMethod.java
index 7715122..52017d1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryMethod.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryMethod.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2015 IBM Corporation and others.
+ * Copyright (c) 2004, 2016 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,8 +21,8 @@
private String uniqueKey;
- /*
- * See class comments.
+ /**
+ * The parameter type signatures are expected to be dot-based.
*/
public ResolvedBinaryMethod(JavaElement parent, String name, String[] parameterTypes, String uniqueKey) {
super(parent, name, parameterTypes);
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java
index aeec077..1972f92 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java
@@ -15,6 +15,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jdt.core.search.*;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.index.FileIndexLocation;
@@ -52,28 +53,22 @@
getIndexes(null/*progress*/); // may trigger some index recreation
}
public boolean execute(IProgressMonitor progressMonitor) {
- if (progressMonitor != null && progressMonitor.isCanceled()) throw new OperationCanceledException();
+ SubMonitor subMonitor = SubMonitor.convert(progressMonitor, 3);
boolean isComplete = COMPLETE;
this.executionTime = 0;
- Index[] indexes = getIndexes(progressMonitor);
+ Index[] indexes = getIndexes(subMonitor.split(1));
try {
int max = indexes.length;
- if (progressMonitor != null)
- progressMonitor.beginTask("", max); //$NON-NLS-1$
+ SubMonitor loopMonitor = subMonitor.split(2).setWorkRemaining(max);
for (int i = 0; i < max; i++) {
- isComplete &= search(indexes[i], progressMonitor);
- if (progressMonitor != null) {
- if (progressMonitor.isCanceled()) throw new OperationCanceledException();
- progressMonitor.worked(1);
- }
+ isComplete &= search(indexes[i], loopMonitor.split(1));
}
if (JobManager.VERBOSE)
Util.verbose("-> execution time: " + this.executionTime + "ms - " + this);//$NON-NLS-1$//$NON-NLS-2$
return isComplete;
} finally {
- if (progressMonitor != null)
- progressMonitor.done();
+ SubMonitor.done(progressMonitor);
}
}
public Index[] getIndexes(IProgressMonitor progressMonitor) {
diff --git a/releng/build-scripts/build/otdt_prerequisites.sh b/releng/build-scripts/build/otdt_prerequisites.sh
index 35d9041..f13992c 100644
--- a/releng/build-scripts/build/otdt_prerequisites.sh
+++ b/releng/build-scripts/build/otdt_prerequisites.sh
@@ -52,14 +52,14 @@
# VERSIONS:
# Eclipse SDK build identifier (used for substitution in otdt.map.in etc.):
-SDK_QUALIFIER=I20160428-0800
+SDK_QUALIFIER=I20160511-2000
# Architecture (as used by OSGi):
ARCH=`arch`
# used only locally (components of the ECLIPSE_SDK_TGZ path):
-EVERSION=4.6M7
-DROP=${BASEDIR}/drops4/S-4.6M7-201604280800
+EVERSION=I20160511-2000
+DROP=${BASEDIR}/drops4/I20160511-2000
# EXPORT: archive file of the base eclipse SDK build:
ECLIPSE_SDK_TGZ=${DROP}/eclipse-SDK-${EVERSION}-linux-gtk-${ARCH}.tar.gz
diff --git a/releng/build-scripts/build/run.properties b/releng/build-scripts/build/run.properties
index 6481a64..6f18596 100644
--- a/releng/build-scripts/build/run.properties
+++ b/releng/build-scripts/build/run.properties
@@ -26,8 +26,8 @@
org.eclipse.equinox.launcher_jar=org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
# for patching our patch feature to match this version with any suffix:
-jdt.feature.version=3.12.0.v20160428-0800
-jdt.feature.version.next=3.12.0.v20160428-801
+jdt.feature.version=3.12.0.v20160511-2000
+jdt.feature.version.next=3.12.0.v20160511-2001
# -----------------------------------------------------------
#Git Support for PDE BUILD: