update jdt.core to S4_8_0_RC2
diff --git a/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt b/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt
new file mode 100644
index 0000000..c997cd7
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt
@@ -0,0 +1,2 @@
+# To force a version qualifier update, add the bug here
+Bug 534597 - Unanticipated comparator errors in I20180511-2000
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
index 985f853..2b46cee 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java
@@ -866,7 +866,7 @@
"1. WARNING in module-info.java (at line 2)\n" +
" requires jdk.xml.bind;\n" +
" ^^^^^^^^^^^^\n" +
- "The module jdk.xml.bind is deprecated since version 9\n" +
+ "The module jdk.xml.bind has been deprecated since version 9 and marked for removal\n" +
"----------\n";
runner.runWarningTest();
} finally {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
index e0e69a8..f5fac6a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
@@ -22070,9 +22070,7 @@
"element:RANKING_ATTRIBUTE_V2 completion:RANKING_ATTRIBUTE_V2 relevance:" + relevance +"\n" +
"element:REFERENCE_ATTRIBUTE completion:REFERENCE_ATTRIBUTE relevance:" + relevance +"\n" +
"element:WORK_ATTRIBUTE completion:WORK_ATTRIBUTE relevance:" + relevance +"\n" +
- "element:class completion:class relevance:" + relevance +"\n" +
- "element:super completion:super relevance:" + relevance + "\n" +
- "element:this completion:this relevance:" + relevance,
+ "element:class completion:class relevance:" + relevance,
requestor.getResults());
} finally {
// Restore compliance settings.
@@ -25800,4 +25798,96 @@
"zzz[FIELD_REF]{zzz, LCompletionAfterCase1;, I, zzz, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_EXACT_EXPECTED_TYPE + R_CASE + R_UNQUALIFIED + R_NON_RESTRICTED + R_FINAL) + "}",
requestor.getResults());
}
+public void testBug533740a() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/Foo.java",
+ "interface X extends Y {\n" +
+ " public default void foo() {\n" +
+ " X.t\n" +
+ " }\n" +
+ "}\n" +
+ "interface Y {\n" +
+ " public default void bar() {}\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "X.t";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults(
+ "this[KEYWORD]{this, null, null, this, null, 51}",
+ requestor.getResults());
+}
+public void testBug533740b() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/Foo.java",
+ "interface X extends Y {\n" +
+ " public default void foo() {\n" +
+ " X.s\n" +
+ " }\n" +
+ "}\n" +
+ "interface Y {\n" +
+ " public default void bar() {}\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "X.s";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults(
+ "",
+ requestor.getResults());
+}
+public void testBug533740c() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/Foo.java",
+ "interface X extends Y {\n" +
+ " public default void foo() {\n" +
+ " Y.t\n" +
+ " }\n" +
+ "}\n" +
+ "interface Y {\n" +
+ " public default void bar() {}\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "Y.t";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults(
+ "",
+ requestor.getResults());
+}
+public void testBug533740d() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/Foo.java",
+ "interface X extends Y {\n" +
+ " public default void foo() {\n" +
+ " Y.s\n" +
+ " }\n" +
+ "}\n" +
+ "interface Y {\n" +
+ " public default void bar() {}\n" +
+ "}\n");
+
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "Y.s";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults(
+ "super[KEYWORD]{super, null, null, super, null, 51}",
+ requestor.getResults());
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java
index 68106f3..653bf3b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests18.java
@@ -239,8 +239,6 @@
assertResults(
"class[FIELD_REF]{class, null, Ljava.lang.Class<LX;>;, class, null, " + (R_DEFAULT + 21) + "}\n" +
"f[FIELD_REF]{f, LX;, LFoo;, f, null, " + (R_DEFAULT + 21) + "}\n" +
- "super[KEYWORD]{super, null, null, super, null, " + (R_DEFAULT + 21) + "}\n" +
- "this[KEYWORD]{this, null, null, this, null, " + (R_DEFAULT + 21) + "}\n" +
"x1[FIELD_REF]{x1, LX;, I, x1, null, " + (R_DEFAULT + 51) + "}",
requestor.getResults());
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
index eb1b334..a17703b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleBuilderTests.java
@@ -6279,7 +6279,7 @@
IJavaProject javaProject = createJava9Project("mod1", new String[] {"src"});
String srcMod =
- "@SuppressWarnings(\"deprecation\")\n" + // javax.xml.ws.annotation is deprecated
+ "@SuppressWarnings(\"removal\")\n" + // javax.xml.ws.annotation is deprecated for removal
"module mod1 {\n" +
" exports com.mod1.pack1;\n" +
" requires java.xml.ws.annotation;\n" +
@@ -6910,6 +6910,54 @@
deleteProject(p1);
}
}
+ // automatic modules export all their packages
+ public void testBug532724() throws CoreException, IOException {
+ if (!isJRE9) return;
+ try {
+ String libPath = "externalLib/test.jar";
+ Util.createJar(
+ new String[] {
+ "test/src/org/astro/World.java", //$NON-NLS-1$
+ "package org.astro;\n" +
+ "public interface World {\n" +
+ " public String name();\n" +
+ "}",
+ },
+ null,
+ new HashMap<>(),
+ null,
+ getExternalResourcePath(libPath));
+ String[] src = new String[] {
+ "src/module-info.java",
+ "module com.greetings {\n" +
+ " requires transitive test;\n" +
+ " exports com.greetings;\n" +
+ "}",
+ "src/com/greetings/MyWorld.java",
+ "package com.greetings;\n" +
+ "import org.astro.World;\n" +
+ "public class MyWorld {\n" +
+ " public World name() {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}"
+ };
+ IClasspathAttribute modAttr = new ClasspathAttribute("module", "true");
+ IClasspathEntry dep = JavaCore.newLibraryEntry(new Path(getExternalResourcePath(libPath)), null, null, ClasspathEntry.NO_ACCESS_RULES,
+ new IClasspathAttribute[] {modAttr},
+ false/*not exported*/);
+ IJavaProject p2 = setupModuleProject("com.greetings", src, new IClasspathEntry[] { dep });
+ p2.setOption(JavaCore.COMPILER_PB_UNSTABLE_AUTO_MODULE_NAME, JavaCore.IGNORE);
+ p2.setOption(JavaCore.COMPILER_PB_API_LEAKS, JavaCore.ERROR);
+
+ getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IMarker[] markers = p2.getProject().findMarkers(null, true, IResource.DEPTH_INFINITE);
+ assertMarkers("Unexpected markers", "", markers);
+ } finally {
+ deleteExternalResource("externalLib");
+ this.deleteProject("com.greetings");
+ }
+ }
protected void assertNoErrors() throws CoreException {
for (IProject p : getWorkspace().getRoot().getProjects()) {
int maxSeverity = p.findMaxProblemSeverity(null, true, IResource.DEPTH_INFINITE);
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java
index cdee72b..cf6c3bf 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests9.java
@@ -12,6 +12,9 @@
package org.eclipse.jdt.core.tests.model;
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IProblemRequestor;
@@ -68,7 +71,7 @@
super.setUpSuite();
// Create project with 9 compliance
- IJavaProject project9 = createJavaProject("Reconciler9", new String[] {"src"}, new String[] {"JCL9_LIB"}, "bin");
+ IJavaProject project9 = createJava9Project("Reconciler9");
createFile(
"/Reconciler9/src/module-info.java",
"/**\n" +
@@ -84,6 +87,16 @@
}
+protected void setUpWorkingCopy(String path, String contents) throws JavaModelException {
+ setUpWorkingCopy(path, contents, this.wcOwner);
+}
+private void setUpWorkingCopy(String path, String contents, WorkingCopyOwner owner) throws JavaModelException {
+ this.workingCopy.discardWorkingCopy();
+ this.workingCopy = getCompilationUnit(path).getWorkingCopy(owner, null);
+ assertEquals("Invalid problem requestor!", this.problemRequestor, this.wcOwner.getProblemRequestor(this.workingCopy));
+ setWorkingCopyContents(contents);
+ this.workingCopy.makeConsistent(null);
+}
void setWorkingCopyContents(String contents) throws JavaModelException {
this.workingCopy.getBuffer().setContents(contents);
this.problemRequestor.initialize(contents.toCharArray());
@@ -251,4 +264,111 @@
"mod.one[*]: {CATEGORIES}"
);
}
+public void testTerminalDeprecation1() throws CoreException {
+ try {
+ createJava9Project("P1");
+ createFolder("/P1/src/p");
+ createFile("/P1/src/p/X1.java",
+ "package p;\n" +
+ "@Deprecated(forRemoval=true)\n" +
+ "public class X1 {}");
+ createFile("/P1/src/p/X2.java",
+ "package p;\n" +
+ "public class X2 {\n" +
+ " @Deprecated(forRemoval=true)\n" +
+ " public Object field;\n" +
+ " @Deprecated(forRemoval=true)\n" +
+ " public void m() {}\n" +
+ "}\n");
+
+ setUpWorkingCopy("/P1/src/Y.java",
+ "public class Y extends p.X1 {\n" +
+ " Object foo(p.X2 x2) {\n" +
+ " x2.m();\n" +
+ " return x2.field;\n" +
+ " }\n" +
+ "}\n");
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "1. WARNING in /P1/src/Y.java (at line 1)\n" +
+ " public class Y extends p.X1 {\n" +
+ " ^^\n" +
+ "The type X1 has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "2. WARNING in /P1/src/Y.java (at line 3)\n" +
+ " x2.m();\n" +
+ " ^^^\n" +
+ "The method m() from the type X2 has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "3. WARNING in /P1/src/Y.java (at line 4)\n" +
+ " return x2.field;\n" +
+ " ^^^^^\n" +
+ "The field X2.field has been deprecated and marked for removal\n" +
+ "----------\n"
+ );
+ } finally {
+ deleteProject("P1");
+ }
+}
+public void testTerminalDeprecation2() throws CoreException, IOException {
+ try {
+ IJavaProject p1 = createJava9Project("P1");
+ createJar(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "@Deprecated(forRemoval=true)\n" +
+ "public class X1 {}",
+ "/P1/src/p/X2.java",
+ "package p;\n" +
+ "public class X2 {\n" +
+ " @Deprecated(forRemoval=true)\n" +
+ " public Object field;\n" +
+ " @Deprecated(forRemoval=true)\n" +
+ " public void m() {}\n" +
+ " @Deprecated public void m2() {}\n" +
+ "}\n"
+ },
+ p1.getProject().getLocation().append("lib.jar").toOSString(),
+ null,
+ "9");
+ p1.getProject().refreshLocal(2, null);
+ addLibraryEntry(p1, "/P1/lib.jar", false);
+
+ setUpWorkingCopy("/P1/src/Y.java",
+ "public class Y extends p.X1 {\n" +
+ " Object foo(p.X2 x2) {\n" +
+ " x2.m();\n" +
+ " x2.m2();\n" +
+ " return x2.field;\n" +
+ " }\n" +
+ "}\n");
+ assertProblems(
+ "Unexpected problems",
+ "----------\n" +
+ "1. WARNING in /P1/src/Y.java (at line 1)\n" +
+ " public class Y extends p.X1 {\n" +
+ " ^^\n" +
+ "The type X1 has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "2. WARNING in /P1/src/Y.java (at line 3)\n" +
+ " x2.m();\n" +
+ " ^^^\n" +
+ "The method m() from the type X2 has been deprecated and marked for removal\n" +
+ "----------\n" +
+ "3. WARNING in /P1/src/Y.java (at line 4)\n" +
+ " x2.m2();\n" +
+ " ^^^^\n" +
+ "The method m2() from the type X2 is deprecated\n" +
+ "----------\n" +
+ "4. WARNING in /P1/src/Y.java (at line 5)\n" +
+ " return x2.field;\n" +
+ " ^^^^^\n" +
+ "The field X2.field has been deprecated and marked for removal\n" +
+ "----------\n");
+ } finally {
+ deleteProject("P1");
+ }
+}
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
index 65095d3..872b4d9 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
@@ -18,6 +18,7 @@
package org.eclipse.jdt.internal.codeassist;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
@@ -10320,8 +10321,44 @@
((scope instanceof MethodScope && !((MethodScope)scope).isStatic)
|| ((methodScope = scope.enclosingMethodScope()) != null && !methodScope.isStatic))) {
if (token.length >= 0) {
- findKeywords(token, new char[][]{Keywords.THIS, Keywords.SUPER}, true, false);
- }
+ boolean isInterface = false;
+ if (receiverType != null) {
+ isInterface = receiverType.isInterface();
+ }
+ if (!isInterface) {
+ findKeywords(token, new char[][] { Keywords.THIS, Keywords.SUPER }, true, false);
+ } else {
+ boolean isEqual = false;
+ char[] enclosingSourceName = null;
+ if(scope.enclosingSourceType() != null)
+ enclosingSourceName = scope.enclosingSourceType().sourceName;
+ char[] receiverSourceName = null;
+ if (receiverType != null) {
+ receiverSourceName = receiverType.sourceName;
+ }
+ if( enclosingSourceName !=null & receiverSourceName !=null)
+ isEqual = Arrays.equals(enclosingSourceName, receiverSourceName);
+ if(isEqual) {
+ findKeywords(token, new char[][] { Keywords.THIS }, true, false);
+ } else {
+ // Check if the enclosing source implements this interface then show super
+ if (scope.enclosingSourceType() != null) {
+ SourceTypeBinding src = scope.enclosingSourceType();
+ ReferenceBinding[] superInterfaces = src.superInterfaces();
+ boolean implemented = false;
+ for (ReferenceBinding referenceBinding : superInterfaces) {
+ if (Arrays.equals(referenceBinding.sourceName, receiverSourceName)) {
+ implemented = true;
+ break;
+ }
+ }
+ if (implemented) {
+ findKeywords(token, new char[][] { Keywords.SUPER }, true, false);
+ }
+ }
+ }
+ }
+ }
}
if (!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
index ee67c1d..8b0e26b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java
@@ -396,6 +396,16 @@
int tag = u1At(currentOffset);
currentOffset++;
switch (tag) {
+ case 'Z':
+ if ((this.standardAnnotationTagBits & TagBits.AnnotationDeprecated) != 0) {
+ // assume member_name is 'since', because @Deprecated has only one boolean member
+ int constantOffset = this.constantPoolOffsets[u2At(currentOffset)] - this.structOffset + 1;
+ if (i4At(constantOffset) == 1) {
+ this.standardAnnotationTagBits |= TagBits.AnnotationTerminallyDeprecated;
+ }
+ }
+ currentOffset += 2;
+ break;
case 'B':
case 'C':
case 'D':
@@ -403,7 +413,6 @@
case 'I':
case 'J':
case 'S':
- case 'Z':
case 's':
case 'c':
currentOffset += 2;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
index c992316..a3e6db2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -6271,7 +6271,7 @@
this.stackDepth++;
if (this.stackDepth > this.stackMax)
this.stackMax = this.stackDepth;
- if (this.classFileOffset + 2 >= this.bCodeStream.length) {
+ if (this.classFileOffset + 3 >= this.bCodeStream.length) {
resizeByteArray();
}
this.position++;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
index f782333..8df4ccb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java
@@ -1045,6 +1045,11 @@
case '1':
if (version.length() > 1 && version.charAt(1) == '0') {
return ClassFileConstants.JDK10; // Level for JDK 10
+ } else {
+ int versionAfterTen = Integer.parseInt("" + version.charAt(1)); //$NON-NLS-1$
+ int majorVersion = ClassFileConstants.MAJOR_VERSION_10 + versionAfterTen;
+ long jdkLevel = ((long)majorVersion << 16) + ClassFileConstants.MINOR_VERSION_0;
+ return jdkLevel;
}
// No default - let it go through the remaining checks.
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index b0757c0..da3a916 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -750,14 +750,12 @@
FieldBinding field = this.fields[i];
if (!field.isDeprecated()) {
field.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
- field.tagBits |= this.tagBits & TagBits.AnnotationTerminallyDeprecated;
}
}
for (int i = 0, max = this.methods.length; i < max; i++) {
MethodBinding method = this.methods[i];
if (!method.isDeprecated()) {
method.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
- method.tagBits |= this.tagBits & TagBits.AnnotationTerminallyDeprecated;
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
index 338c22c..ca8a662 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -513,9 +513,13 @@
*/
public boolean isExported() {
if (this.isExported == null) {
- this.enclosingModule.getExports(); // ensure resolved and completed
- if (this.isExported == null)
- this.isExported = Boolean.FALSE;
+ if (this.enclosingModule.isAuto) {
+ this.isExported = Boolean.TRUE;
+ } else {
+ this.enclosingModule.getExports(); // ensure resolved and completed
+ if (this.isExported == null)
+ this.isExported = Boolean.FALSE;
+ }
}
return this.isExported == Boolean.TRUE;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
index 9517462..399783f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java
@@ -80,7 +80,7 @@
if (typeInfo == null) {
// The structure of a class file is unknown if a class file format errors occurred
//during the creation of the diet class file representative of this ClassFile.
- info.setChildren(new IJavaElement[] {});
+ info.setChildren(JavaElement.NO_ELEMENTS);
return false;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/OpenableElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/OpenableElementInfo.java
index 5509a8b..c33c0e1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/OpenableElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/OpenableElementInfo.java
@@ -85,7 +85,7 @@
}
public void setChildren(IJavaElement[] children) {
- this.children = children;
+ this.children= (children.length > 0) ? children : JavaElement.NO_ELEMENTS;
}
public void setModule(IModuleDescription module) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
index 2020f29..25ea679 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java
@@ -115,9 +115,13 @@
}
}
- IJavaElement[] children = new IJavaElement[vChildren.size()];
- vChildren.toArray(children);
- info.setChildren(children);
+ if (!vChildren.isEmpty()) {
+ IJavaElement[] children = new IJavaElement[vChildren.size()];
+ vChildren.toArray(children);
+ info.setChildren(children);
+ } else {
+ info.setChildren(JavaElement.NO_ELEMENTS);
+ }
return true;
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
index 1b950d2..8362861 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java
@@ -206,9 +206,13 @@
// if (module != null && module.exists()) {
// vChildren.add(new ClassFile(getPackageFragment(CharOperation.NO_STRINGS), String.valueOf(TypeConstants.MODULE_INFO_NAME)));
// }
- IJavaElement[] children = new IJavaElement[vChildren.size()];
- vChildren.toArray(children);
- info.setChildren(children);
+ if (!vChildren.isEmpty()) {
+ IJavaElement[] children = new IJavaElement[vChildren.size()];
+ vChildren.toArray(children);
+ info.setChildren(children);
+ } else {
+ info.setChildren(JavaElement.NO_ELEMENTS);
+ }
}
} catch (JavaModelException e) {
//problem resolving children; structure remains unknown
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java
index 7111f94..8d167c5 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java
@@ -590,7 +590,8 @@
default:
if (this.modulePathEntries != null) {
names = CharOperation.NO_CHAR_CHAR;
- for (IModulePathEntry modulePathEntry : this.modulePathEntries.values()) {
+ Collection<IModulePathEntry> entries = new HashSet<>(this.modulePathEntries.values());
+ for (IModulePathEntry modulePathEntry : entries) {
char[][] declaringModules = modulePathEntry.getModulesDeclaringPackage(pkgName, modName);
if (declaringModules != null)
names = CharOperation.arrayConcat(names, declaringModules);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java
index 63458bf..8e28203 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 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
@@ -320,6 +320,7 @@
IJavaProject currentProject = null;
for (int i = 0; i < length; i++) {
loopMonitor.setWorkRemaining(length - i + 1);
+ IJavaProject nextProject = null;
try {
String resourcePath = allPotentialSubTypes[i];
@@ -343,15 +344,19 @@
currentProject = project;
potentialSubtypes = new ArrayList(5);
} else if (!currentProject.equals(project)) {
+ nextProject = project;
// build current project
buildForProject((JavaProject)currentProject, potentialSubtypes, workingCopies, localTypes, loopMonitor.split(1));
- currentProject = project;
potentialSubtypes = new ArrayList(5);
}
potentialSubtypes.add(handle);
} catch (JavaModelException e) {
continue;
+ } finally {
+ if (nextProject != null) {
+ currentProject = nextProject;
+ }
}
}