update jdt.core to I20190919-0850 after BETA_JAVA13 merge
bump up to 3.20.0.OTDT_r276
diff --git a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
index 348473c..474e915 100644
--- a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
+++ b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
@@ -66,7 +66,7 @@
id="org.eclipse.jdt.core"
download-size="5614"
install-size="5614"
- version="3.19.0.OTDT_r275_qualifier"
+ version="3.19.0.OTDT_r276_qualifier"
unpack="false"/>
</feature>
diff --git a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
index f0a3c3b..3c8e3e4 100644
--- a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.compiler;singleton:=true
-Bundle-Version: 3.12.951.qualifier
+Bundle-Version: 3.12.1000.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests.compiler,
diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml
index 17f166f..f3fd207 100644
--- a/org.eclipse.jdt.core.tests.compiler/pom.xml
+++ b/org.eclipse.jdt.core.tests.compiler/pom.xml
@@ -15,12 +15,12 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>eclipse.jdt.core</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.14.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.compiler</artifactId>
- <version>3.12.951-SNAPSHOT</version>
+ <version>3.12.1000-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
index 66b2f66..4de2459 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - adapted for Object Teams
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java
index 7048f31..e9c12eb 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -17,6 +17,7 @@
import java.util.Map;
import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -753,6 +754,25 @@
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=239198
*/
public void test028() {
+ String error = (this.complianceLevel == ClassFileConstants.JDK13) ?
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " Srtring bar = \"\"\"\n" +
+ " }\n" +
+ " ^^^^^^^^^\n" +
+ "Text block is not properly closed with the delimiter\n" +
+ "----------\n" :
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " Srtring bar = \"\"\"\n" +
+ " ^^\n" +
+ "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " Srtring bar = \"\"\"\n" +
+ " ^\n" +
+ "String literal is not properly closed by a double-quote\n" +
+ "----------\n";
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR);
runNegativeTest(
@@ -765,17 +785,7 @@
" }\n" +
"}"
},
- "----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " Srtring bar = \"\"\"\n" +
- " ^^\n" +
- "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" +
- "----------\n" +
- "2. ERROR in X.java (at line 4)\n" +
- " Srtring bar = \"\"\"\n" +
- " ^\n" +
- "String literal is not properly closed by a double-quote\n" +
- "----------\n",
+ error,
null,
true,
options);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java
index 434612a..854d12d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
index 715e970..5f0c5c3 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Jesper Steen Møller <jesper@selskabet.org> - Contributions for
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
index eeecb1c..6aa1b0a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
@@ -8201,6 +8201,71 @@
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=210213 - variation
+public void test245_ignored() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_ReportSuppressWarningNotFullyAnalysed, CompilerOptions.IGNORE);
+ enableAllWarningsForIrritants(options, IrritantSet.UNUSED);
+ this.runNegativeTest(
+ true,
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " \n" +
+ " @SuppressWarnings({\"unchecked\",\"unused\"})\n" +
+ " void foo() {\n" +
+ " \n" +
+ " }\n" +
+ "} \n",
+ },
+ null, options,
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " @SuppressWarnings({\"unchecked\",\"unused\"})\n" +
+ " ^^^^^^^^\n" +
+ "Unnecessary @SuppressWarnings(\"unused\")\n" +
+ "----------\n",
+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=210213 - variation
+public void test245_error() {
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
+ options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportRawTypeReference, CompilerOptions.IGNORE);
+ options.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.WARNING);
+ options.put(CompilerOptions.OPTION_ReportSuppressWarningNotFullyAnalysed, CompilerOptions.ERROR);
+ enableAllWarningsForIrritants(options, IrritantSet.UNUSED);
+ this.runNegativeTest(
+ true,
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " \n" +
+ " @SuppressWarnings({\"unchecked\",\"unused\"})\n" +
+ " void foo() {\n" +
+ " \n" +
+ " }\n" +
+ "} \n",
+ },
+ null, options,
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " @SuppressWarnings({\"unchecked\",\"unused\"})\n" +
+ " ^^^^^^^^^^^\n" +
+ "At least one of the problems in category \'unchecked\' is not analysed due to a compiler option being ignored\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " @SuppressWarnings({\"unchecked\",\"unused\"})\n" +
+ " ^^^^^^^^\n" +
+ "Unnecessary @SuppressWarnings(\"unused\")\n" +
+ "----------\n",
+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=210213 - variation
public void test246() {
Map options = getCompilerOptions();
options.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
@@ -12236,4 +12301,43 @@
};
runner.runConformTest();
}
+public void testBug490698_comment16() {
+ runConformTest(
+ new String[] {
+ "foo/bar/AnnotationError.java",
+ "package foo.bar;\n" +
+ "\n" +
+ "import static java.lang.annotation.ElementType.FIELD;\n" +
+ "import static java.lang.annotation.RetentionPolicy.RUNTIME;\n" +
+ "\n" +
+ "import java.lang.annotation.Retention;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "import java.util.function.Predicate;\n" +
+ "\n" +
+ "public class AnnotationError<T> {\n" +
+ "\n" +
+ " public enum P {\n" +
+ " AAA\n" +
+ " }\n" +
+ "\n" +
+ " @Target(FIELD)\n" +
+ " @Retention(RUNTIME)\n" +
+ " public @interface A {\n" +
+ " P value();\n" +
+ " }\n" +
+ "\n" +
+ " @Target(FIELD)\n" +
+ " @Retention(RUNTIME)\n" +
+ " public @interface FF {\n" +
+ " }\n" +
+ "\n" +
+ " public static class Bool extends AnnotationError<Boolean> {\n" +
+ " }\n" +
+ "\n" +
+ " @A(P.AAA)\n" +
+ " @FF\n" +
+ " public static final AnnotationError.Bool FOO = new AnnotationError.Bool();\n" +
+ "}\n"
+ });
+}
}
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 53e2dd5..884b680 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
@@ -1144,6 +1144,7 @@
" <option key=\"org.eclipse.jdt.core.compiler.problem.staticAccessReceiver\" value=\"warning\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors\" value=\"disabled\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarnings\" value=\"enabled\"/>\n" +
+ " <option key=\"org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed\" value=\"info\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields\" value=\"disabled\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.tasks\" value=\"warning\"/>\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index b39b94f..4b39c6b 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Benjamin Muskalla - Contribution for bug 239066
@@ -420,6 +416,7 @@
expectedProblemAttributes.put("CodeCannotBeReached", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("CodeSnippetMissingClass", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("CodeSnippetMissingMethod", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
+ expectedProblemAttributes.put("ConstNonNullFieldComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("ContainerAnnotationTypeHasNonDefaultMembers", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("ContainerAnnotationTypeHasShorterRetention", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("ContainerAnnotationTypeHasWrongValueType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
@@ -1476,6 +1473,7 @@
expectedProblemAttributes.put("CodeSnippetMissingClass", SKIP);
expectedProblemAttributes.put("CodeSnippetMissingMethod", SKIP);
expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(JavaCore.COMPILER_PB_COMPARING_IDENTICAL));
+ expectedProblemAttributes.put("ConstNonNullFieldComparisonYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
expectedProblemAttributes.put("ConflictingImport", SKIP);
expectedProblemAttributes.put("ConflictingNullAnnotations", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
expectedProblemAttributes.put("ConstructedArrayIncompatible", SKIP);
@@ -1992,6 +1990,7 @@
expectedProblemAttributes.put("PotentialNullLocalVariableReference", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
expectedProblemAttributes.put("PotentialNullUnboxing", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
expectedProblemAttributes.put("PotentialNullMessageSendReference", new ProblemAttributes(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE));
+ expectedProblemAttributes.put("ProblemNotAnalysed", new ProblemAttributes(JavaCore.COMPILER_PB_SUPPRESS_WARNINGS_NOT_FULLY_ANALYSED));
expectedProblemAttributes.put("ProviderMethodOrConstructorRequiredForServiceImpl", SKIP);
expectedProblemAttributes.put("PublicClassMustMatchFileName", SKIP);
expectedProblemAttributes.put("RawMemberTypeCannotBeParameterized", SKIP);
@@ -2210,7 +2209,6 @@
expectedProblemAttributes.put("DisallowedExplicitThisParameter", SKIP);
expectedProblemAttributes.put("IllegalArrayOfUnionType", SKIP);
expectedProblemAttributes.put("IllegalArrayTypeInIntersectionCast", SKIP);
- expectedProblemAttributes.put("ProblemNotAnalysed", SKIP);
//{ObjectTeams: new constants:
expectedProblemAttributes.put("OTJ_RELATED", SKIP);
expectedProblemAttributes.put("OTCHAP", SKIP);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
index bb3b8b0..6fc9032 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
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 1abf4f9..fcf06d9 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
@@ -9955,4 +9955,55 @@
"}\n"
});
}
+
+ public void testBug534466() {
+ runNegativeTest(
+ new String[] {
+ "test/TODO.java",
+ "package test;\n" +
+ "public interface TODO {\n" +
+ " boolean test();\n" +
+ "}\n",
+ "test/FuncN.java",
+ "package test;\n" +
+ "\n" +
+ "@FunctionalInterface\n" +
+ "public interface FuncN {\n" +
+ " State zip(State ...states);\n" +
+ "}\n",
+ "test/Test.java",
+ "package test;\n" +
+ "public class Test {\n" +
+ "\n" +
+ " public static Test define(FuncN zipperFunc,TODO... tasks) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "\n" +
+ " public static Test define(TODO... tasks) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n",
+ "test/State.java",
+ "package test;\n" +
+ "public class State {\n" +
+ " public static State mergeStates(State ...states) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n",
+ "test/Main.java",
+ "package test;\n" +
+ "\n" +
+ "public class Main {\n" +
+ " public static void main(String[] args) {\n" +
+ " Test.define(State::mergeStates,()->true);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in test\\Main.java (at line 5)\n" +
+ " Test.define(State::mergeStates,()->true);\n" +
+ " ^^^^^^\n" +
+ "The method define(FuncN, TODO[]) is ambiguous for the type Test\n" +
+ "----------\n");
+ }
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
index 83ba8fc..242673e 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* Stephan Herrmann - initial API and implementation
* Till Brychcy <register.eclipse@brychcy.de> - Contribution for
@@ -29,6 +25,7 @@
import junit.framework.Test;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest.JavacTestOptions.Excuse;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
@@ -10973,6 +10970,7 @@
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"Dead code\n" +
"----------\n";
+ runner.javacTestOptions = Excuse.EclipseWarningConfiguredAsError;
runner.runNegativeTest();
}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
index ed6a8d6..50a2135 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java
@@ -17457,7 +17457,7 @@
"1. ERROR in Test.java (at line 10)\n" +
" if (a != null) {\n" +
" ^\n" +
- "Null comparison always yields false: The field a is a nonnull constant\n" +
+ "Redundant null check: The field a is a nonnull constant\n" +
"----------\n" +
"2. WARNING in Test.java (at line 15)\n" +
" } else {\n" +
@@ -17467,7 +17467,7 @@
"Statement unnecessarily nested within else clause. The corresponding then clause does not complete normally\n" +
"----------\n";
runner.customOptions = getCompilerOptions();
- runner.javacTestOptions = JavacTestOptions.Excuse.EclipseHasSomeMoreWarnings;
+ runner.javacTestOptions = JavacTestOptions.Excuse.EclipseWarningConfiguredAsError;
runner.runNegativeTest();
}
public void testBug435528_notaconstant() {
@@ -18332,4 +18332,55 @@
"----------\n"
);
}
+public void testBug551012() {
+ runNegativeNullTest(
+ new String[] {
+ "NullConstants.java",
+ "public class NullConstants {\n" +
+ " protected static final String FOO = null;\n" +
+ "\n" +
+ " protected String foo = FOO;\n" +
+ "\n" +
+ " protected static final String BAR = \"\";\n" +
+ "\n" +
+ " protected String bar = BAR;\n" +
+ "\n" +
+ " public boolean notAProblemButWhyNot() {\n" +
+ " return FOO == null ? foo != null : !FOO.equals(foo);\n" +
+ " }\n" +
+ "\n" +
+ " public boolean alsoNotAProblemButThisWillAlwaysNPE() {\n" +
+ " return FOO != null ? foo != null : !FOO.equals(foo);\n" +
+ " }\n" +
+ "\n" +
+ " public boolean aProblemButHowToAvoid() {\n" +
+ " return BAR == null ? bar != null : !BAR.equals(bar);\n" +
+ " }\n" +
+ "\n" +
+ " public boolean wrongpProblemMessage() {\n" +
+ " return BAR != null ? !BAR.equals(bar) : bar != null;\n" +
+ " }\n" +
+ "\n" +
+ " public boolean howAboutThis() {\n" +
+ " return bar == null ? BAR != null : bar.equals(BAR);\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in NullConstants.java (at line 19)\n" +
+ " return BAR == null ? bar != null : !BAR.equals(bar);\n" +
+ " ^^^\n" +
+ "Null comparison always yields false: The field BAR is a nonnull constant\n" +
+ "----------\n" +
+ "2. ERROR in NullConstants.java (at line 23)\n" +
+ " return BAR != null ? !BAR.equals(bar) : bar != null;\n" +
+ " ^^^\n" +
+ "Redundant null check: The field BAR is a nonnull constant\n" +
+ "----------\n" +
+ "3. ERROR in NullConstants.java (at line 27)\n" +
+ " return bar == null ? BAR != null : bar.equals(BAR);\n" +
+ " ^^^\n" +
+ "Redundant null check: The field BAR is a nonnull constant\n" +
+ "----------\n");
+}
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
index a77e21c..d76b71d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -2459,7 +2459,7 @@
"}\n",
},
"----------\n" +
- "1. WARNING in node\\Test.java (at line 2)\n" +
+ "1. ERROR in node\\Test.java (at line 2)\n" +
" public class Test {\n" +
" ^^^^\n" +
"The type Test collides with a package\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
index 4305c24..1fef2d0 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionTest.java
@@ -23,7 +23,7 @@
static {
// TESTS_NUMBERS = new int [] { 40 };
-// TESTS_NAMES = new String[] { "_testBug543240" };
+// TESTS_NAMES = new String[] { "testBug548476" };
}
public static Class<?> testClass() {
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
index 756679d..f0dd255 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java
@@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -29,7 +25,7 @@
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testBug550354_01" };
+// TESTS_NAMES = new String[] { "testBug550861_01" };
}
public static Class<?> testClass() {
@@ -91,7 +87,7 @@
JavacTestOptions.forReleaseWithPreview("13", javacAdditionalTestOptions);
runner.runWarningTest();
}
- public void testBug544073_00() {
+ public void testBug544073_000() {
runConformTest(
new String[] {
"X.java",
@@ -3372,4 +3368,116 @@
},
"1");
}
+ public void testBug548418_01() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " @SuppressWarnings({ \"preview\", \"unused\" })\n"+
+ " public static void main(String[] args) {\n"+
+ " int day =10;\n"+
+ " int i = switch (day) {\n"+
+ " default -> {\n"+
+ " for(int j = 0; j < 3; j++) {\n"+
+ " yield 99;\n"+
+ " }\n"+
+ " yield 0;\n"+
+ " }\n"+
+ " };\n"+
+ " System.out.println(i);\n"+
+ " }\n"+
+ "}\n"
+ },
+ "99");
+ }
+ public void testBug550853_01() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " @SuppressWarnings({ \"preview\" })\n"+
+ " public static int foo(int i) throws Exception {\n"+
+ " int v = switch (i) {\n"+
+ " default : {yield switch (i) {\n"+
+ " default -> { yield 0; } \n"+
+ " };\n"+
+ " }\n"+
+ " };\n"+
+ " return v;\n"+
+ " }\n"+
+ " public static void main(String argv[]) throws Exception {\n"+
+ " System.out.println(X.foo(1));\n"+
+ " }\n"+
+ "}\n"
+ },
+ "0");
+ }
+ public void testBug550861_01() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " @SuppressWarnings({ \"preview\" })\n"+
+ " public static void foo(int i) throws Exception {\n"+
+ " System.out.println(switch(0) {\n"+
+ " default -> {\n"+
+ " do yield 1; while(false);\n"+
+ " }\n"+
+ " });\n"+
+ " }\n"+
+ " public static void main(String argv[]) throws Exception {\n"+
+ " X.foo(1);\n"+
+ " }\n"+
+ "}\n"
+ },
+ "1");
+ }
+ public void testBug551030a() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " @SuppressWarnings(\"nls\")\n" +
+ " static final String MONDAY = \"MONDAY\";\n" +
+ " public static void main(String[] args) {\n" +
+ " int num = switch (day) {\n" +
+ " case MONDAY: \n" +
+ " // Nothing\n" +
+ " default:\n" +
+ " yield \"; \n" +
+ " }; \n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " yield \"; \n" +
+ " ^^^^^^^\n" +
+ "String literal is not properly closed by a double-quote\n" +
+ "----------\n");
+ }
+ public void testBug551030b() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " @SuppressWarnings(\"nls\")\n" +
+ " static final String MONDAY = \"MONDAY\";\n" +
+ " public static void main(String[] args) {\n" +
+ " int num = switch (day) {\n" +
+ " case MONDAY: \n" +
+ " // Nothing\n" +
+ " default:\n" +
+ " yield \"\"\"; \n" +
+ " }; \n" +
+ " }\n" +
+ "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " yield \"\"\"; \n" +
+ " ^^^^^^^\n" +
+ "String literal is not properly closed by a double-quote\n" +
+ "----------\n");
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
index 9fb808e..5aac8b3 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java
index de7fef3..433f8bf 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
index ee24351..7aad03c 100644
--- a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.model;singleton:=true
-Bundle-Version: 3.10.951.qualifier
+Bundle-Version: 3.10.1000.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests,
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index c6d2ad4..471dcd0 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -15,12 +15,12 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>eclipse.jdt.core</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.14.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.model</artifactId>
- <version>3.10.951-SNAPSHOT</version>
+ <version>3.10.1000-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava12Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava12Tests.java
index 60e0229..ee41a35 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava12Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava12Tests.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*Contributors:
* IBM Corporation - initial API and implementation
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava13Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava13Tests.java
index 50c1dc3..de10caa 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava13Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunAllJava13Tests.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava12Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava12Tests.java
index c483773..c1b0a66 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava12Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava12Tests.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*Contributors:
* IBM Corporation - initial API and implementation
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava13Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava13Tests.java
index 177d593..e8ef362 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava13Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava13Tests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter10Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter10Test.java
index 595c1a5..21285ea 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter10Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter10Test.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter11Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter11Test.java
index 8e5c082..8279e0b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter11Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter11Test.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java
index 6dc9327..867723c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter13Test.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
* Contributors:
* IBM Corporation - initial API and implementation
@@ -32,6 +28,7 @@
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.Statement;
@@ -44,6 +41,7 @@
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
import org.eclipse.jdt.core.dom.YieldStatement;
+import junit.framework.AssertionFailedError;
import junit.framework.Test;
@SuppressWarnings("rawtypes")
@@ -525,7 +523,6 @@
Expression initializer = fragment.getInitializer();
assertTrue("Initializer is not a TextBlock", initializer instanceof TextBlock);
String escapedValue = ((TextBlock) initializer).getEscapedValue();
- System.out.println(escapedValue);
assertTrue("String should not be empty", escapedValue.length() != 0);
assertTrue("String should start with \"\"\"", escapedValue.startsWith("\"\"\""));
@@ -534,4 +531,121 @@
javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
}
}
+ public void test0008() throws JavaModelException {
+ String contents =
+ "public class X {\n" +
+ " public String test001() {\n" +
+ " String s = \"\"\"\n" +
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " \"\"\";\n" +
+ " System.out.println(s);" +
+ " return s;\n" +
+ " }" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter13/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.DISABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ try {
+ buildAST(
+ contents,
+ this.workingCopy);
+ } catch(UnsupportedOperationException e) {
+ fail("Should not throw UnsupportedOperationException");
+ } catch(AssertionFailedError e) {
+ e.printStackTrace();
+ return;
+ }
+ fail("Compilation should not succeed");
+
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ public void test0009() throws JavaModelException {
+ String contents =
+ "public class X {\n" +
+ " public String test001() {\n" +
+ " String s = \"\"\"\n" +
+ " <html>\n" +
+ " <body>\n" +
+ " <p>Hello, world</p>\n" +
+ " </body>\n" +
+ " </html>\n" +
+ " \"\"\";\n" +
+ " System.out.println(s);" +
+ " return s;\n" +
+ " }" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter13/src/X.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Text block statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
+ List fragments = ((VariableDeclarationStatement) node).fragments();
+ assertEquals("Incorrect no of fragments", 1, fragments.size());
+ node = (ASTNode) fragments.get(0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
+ Expression initializer = fragment.getInitializer();
+ assertTrue("Initializer is not a TextBlock", initializer instanceof TextBlock);
+ ITypeBinding binding = initializer.resolveTypeBinding();
+ assertNotNull("No binding", binding);
+ assertEquals("Wrong qualified name", "java.lang.String", binding.getQualifiedName());
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ public void test0010() throws JavaModelException {
+ String contents =
+ "public class test13 {\n" +
+ " public static void main(String[] args) {\n" +
+ " String s = \"\"\"\n" +
+ " nadknaks vgvh \n" +
+ " \"\"\";\n" +
+ "\n" +
+ " int m = 10;\n" +
+ " m = m* 6;\n" +
+ " System.out.println(s);\n" +
+ " }\n" +
+ "}" ;
+ this.workingCopy = getWorkingCopy("/Converter13/src/test13.java", true/*resolve*/);
+ IJavaProject javaProject = this.workingCopy.getJavaProject();
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ javaProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("wrong line number", 3, compilationUnit.getLineNumber(node.getStartPosition()));
+ node = getASTNode(compilationUnit, 0, 0, 1);
+ assertEquals("wrong line number", 7, compilationUnit.getLineNumber(node.getStartPosition()));
+ node = getASTNode(compilationUnit, 0, 0, 2);
+ assertEquals("wrong line number", 8, compilationUnit.getLineNumber(node.getStartPosition()));
+ node = getASTNode(compilationUnit, 0, 0, 3);
+ assertEquals("wrong line number", 9, compilationUnit.getLineNumber(node.getStartPosition()));
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter9Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter9Test.java
index 212b1c0..ae7f6c1 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter9Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter9Test.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
index 9405b8c..9e42a36 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - adapted for Object Teams
@@ -451,9 +447,9 @@
}
// {ObjectTeams: adapted for OT specific ASTNodes
/* orig:
- assertEquals("Wrong last known type", 101, hi); // last known one
+ assertEquals("Wrong last known type", 102, hi); // last known one
:giro */
- assertEquals("Wrong last known type", 117, hi); // last known one
+ assertEquals("Wrong last known type", 118, hi); // last known one
// jwl}
assertEquals("Wrong number of distinct types", hi, classes.size()); // all classes are distinct
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
index 6f84160..9a69c2a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - adapted for Object Teams
@@ -8905,6 +8901,7 @@
ASTNode.PROVIDES_DIRECTIVE,
ASTNode.MODULE_MODIFIER,
ASTNode.SWITCH_EXPRESSION,
+ ASTNode.YIELD_STATEMENT,
ASTNode.TEXT_BLOCK,
//{ObjectTeams:
ASTNode.METHOD_SPEC,
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
index 8786ac3..034a46b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
index ae8e498..b5f9366 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/TypeAnnotationsConverterTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/TypeAnnotationsConverterTest.java
index e9b0d74..9d6a882 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/TypeAnnotationsConverterTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/TypeAnnotationsConverterTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
index 07a741c..cf1f469 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
@@ -39,6 +35,7 @@
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.core.ClasspathAttribute;
import org.eclipse.jdt.internal.core.ClasspathEntry;
import org.eclipse.jdt.internal.core.JavaCorePreferenceInitializer;
import org.eclipse.jdt.internal.core.JavaElement;
@@ -617,6 +614,33 @@
project.refreshLocal(IResource.DEPTH_INFINITE, null);
return project;
}
+
+ static IClasspathAttribute[] externalAnnotationExtraAttributes(String path) {
+ return new IClasspathAttribute[] {
+ new ClasspathAttribute(IClasspathAttribute.EXTERNAL_ANNOTATION_PATH, path)
+ };
+ }
+
+ protected void addLibraryWithExternalAnnotations(
+ IJavaProject javaProject,
+ String compliance,
+ String jarName,
+ String externalAnnotationPath,
+ String[] pathAndContents,
+ Map options) throws CoreException, IOException
+ {
+ createLibrary(javaProject, jarName, "src.zip", pathAndContents, null, compliance, options);
+ String jarPath = '/' + javaProject.getProject().getName() + '/' + jarName;
+ IClasspathEntry entry = JavaCore.newLibraryEntry(
+ new Path(jarPath),
+ new Path('/'+javaProject.getProject().getName()+"/src.zip"),
+ null/*src attach root*/,
+ null/*access rules*/,
+ externalAnnotationExtraAttributes(externalAnnotationPath),
+ false/*exported*/);
+ addClasspathEntry(javaProject, entry);
+ }
+
protected void addLibraryEntry(String path, boolean exported) throws JavaModelException {
addLibraryEntry(this.currentProject, new Path(path), null, null, null, null, exported);
}
@@ -3173,8 +3197,13 @@
String newJclLibString;
String newJclSrcString;
if (useFullJCL) {
- newJclLibString = "JCL18_FULL";
- newJclSrcString = "JCL18_SRC"; // Use the same source
+ if (compliance.equals("10")) {
+ newJclLibString = "JCL10_LIB"; // TODO: have no full variant yet
+ newJclSrcString = "JCL10_SRC";
+ } else {
+ newJclLibString = "JCL18_FULL";
+ newJclSrcString = "JCL18_SRC"; // Use the same source
+ }
} else {
if (compliance.equals("13")) {
newJclLibString = "JCL13_LIB";
@@ -3297,7 +3326,7 @@
setupExternalJCL("jclMin10");
JavaCore.setClasspathVariables(
new String[] {"JCL10_LIB", "JCL10_SRC", "JCL_SRCROOT"},
- new IPath[] {getExternalJCLPath("9"), getExternalJCLSourcePath("9"), getExternalJCLRootSourcePath()},
+ new IPath[] {getExternalJCLPath("10"), getExternalJCLSourcePath("10"), getExternalJCLRootSourcePath()},
null);
}
} else if ("11".equals(compliance)) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java
index aadc76d..ec59a8e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AccessRestrictionsTests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
index 487061a..34262e9 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AllJavaModelTests.java
@@ -102,6 +102,8 @@
ResolveTests2.class,
ResolveTests_1_5.class,
ResolveTests18.class,
+ ResolveTests9.class,
+ ResolveTests10.class,
ResolveTests12.class,
SelectionJavadocModelTests.class,
@@ -216,7 +218,6 @@
JavaElement8Tests.class,
Java9ElementTests.class,
- ResolveTests9.class,
NullAnnotationModelTests9.class,
@@ -268,17 +269,17 @@
suiteMethod = clazz.getDeclaredMethod("suite", new Class[0]);
} catch (NoSuchMethodException e) {
e.printStackTrace();
- continue;
+ throw new AssertionError("Failed to find suite() method for: " + clazz, e);
}
Object test;
try {
test = suiteMethod.invoke(null, new Object[0]);
} catch (IllegalAccessException e) {
e.printStackTrace();
- continue;
+ throw new AssertionError("Failed to invoke suite() method for: " + clazz, e);
} catch (InvocationTargetException e) {
e.printStackTrace();
- continue;
+ throw new AssertionError("Failed to invoke suite() method for: " + clazz, e);
}
suite.addTest((Test) test);
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java
index 7aaed4f..296eb4f 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompilationUnitTests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - contribution for bug 337868 - [compiler][model] incomplete support for package-info.java when using SearchableEnvironment
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java
index 77022c6..bdae724 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests3.java
@@ -39,7 +39,7 @@
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=338398
public void testBug338398a() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/A.java",
@@ -74,7 +74,7 @@
}
public void _testBug338398b() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/A_CLASS.java",
@@ -100,7 +100,7 @@
}
public void _testBug338398c() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/A_CLASS.java",
@@ -126,7 +126,7 @@
}
public void testBug504095() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Bug504095.java",
@@ -155,7 +155,7 @@
}
public void testBug425035a() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -196,7 +196,7 @@
}
public void testBug425035b() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -236,7 +236,7 @@
}
public void testBug425035c() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -277,7 +277,7 @@
}
public void testBug425035d() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -317,7 +317,7 @@
}
public void testBug425035e() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -357,7 +357,7 @@
}
public void testBug425035f() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -398,7 +398,7 @@
}
public void testBug425035_method_a() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -442,7 +442,7 @@
}
public void testBug425035_method_b() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -485,7 +485,7 @@
}
public void testBug425035_method_c() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -529,7 +529,7 @@
}
public void testBug425035_method_d() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -572,7 +572,7 @@
}
public void testBug425035_method_e() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -615,7 +615,7 @@
}
public void testBug425035_method_f() throws CoreException {
try {
- createJavaProject("P", new String[] {"src"}, new String[]{"JCL_LIB"}, "bin", "1.7");
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
this.workingCopies = new ICompilationUnit[3];
this.workingCopies[0] = getWorkingCopy(
"/P/src/a/Values.java",
@@ -657,4 +657,37 @@
deleteProject("P");
}
}
+public void testBug547256() throws CoreException {
+ try {
+ createJavaProject("P", new String[] {"src"}, new String[]{"JCL17_LIB"}, "bin", "1.7");
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/P/src/jdt/Something.java",
+ "package jdt;\n" +
+ "public class Something {\n" +
+ " public static void main(String[] args) {\n" +
+ " done: for (int i = 0; i < 5; ++i) {\n" +
+ " if (i == 3) {\n" +
+ " break done;\n" +
+ " }\n" +
+ " System.out.println(i);\n" +
+ " }\n" +
+ " arg\n" +
+ " System.out.println(\"done\");\n" +
+ " }\n" +
+ "}\n");
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.setAllowsRequiredProposals(CompletionProposal.FIELD_REF, CompletionProposal.TYPE_REF, true);
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "arg";
+ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults(
+ "args[LOCAL_VARIABLE_REF]{args, null, [Ljava.lang.String;, args, null, 52}",
+ requestor.getResults());
+
+ } finally {
+ deleteProject("P");
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java
index 2558f1a..82183a2 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations17Test.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2016 GK Software AG, and others.
+ * Copyright (c) 2015, 2019 GK Software SE, and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.model;
+import java.util.Map;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
@@ -21,6 +23,7 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaModelMarker;
+import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
@@ -165,6 +168,178 @@
}, new int[] { 8 });
}
+ public void testTwoProjects_a() throws Exception {
+ IJavaProject prj2 = null;
+ try {
+ // create project #1:
+ myCreateJavaProject("TestLibs1");
+ addLibraryWithExternalAnnotations(this.project, "lib1.jar", "/TestLibs1", new String[] {
+ "/UnannotatedLib/libs/Lib1.java",
+ "package libs;\n" +
+ "\n" +
+ "public class Lib1 {\n" +
+ " public static String one = \"1\";\n" + // not final!
+ " public static String none = null;\n" +
+ "}\n"
+ }, null);
+ createFileInProject("libs", "Lib1.eea",
+ "class libs/Lib1\n" +
+ "\n" +
+ "one\n" +
+ " Ljava/lang/String;\n" +
+ " L1java/lang/String;\n" +
+ "\n" +
+ "none\n" +
+ " Ljava/lang/String;\n" +
+ " L0java/lang/String;\n" +
+ "\n");
+ IPackageFragment fragment1 = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
+
+ // create project #2 (referring to the same lib, but without external annotations):
+ prj2 = createJavaProject("TestLibs2", new String[]{"src"}, new String[]{this.jclLib, "/TestLibs1/lib1.jar"}, null, null, "bin", null, null, null, this.compliance);
+ addLibraryEntry(prj2, this.ANNOTATION_LIB, false);
+ Map<String,String> options = prj2.getOptions(true);
+ options.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED);
+ prj2.setOptions(options);
+ IPackageFragment fragment2 = prj2.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
+
+ // test project #1:
+ ICompilationUnit unit = fragment1.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
+ " }\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
+ " }\n" +
+ "}\n",
+ true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
+ CompilationUnit reconciled = unit.reconcile(getJLS8(), true, null, new NullProgressMonitor());
+ IProblem[] problems = reconciled.getProblems();
+ assertProblems(problems, new String[] {
+ "Pb(933) Null type mismatch: required '@NonNull String' but the provided value is specified as @Nullable",
+ }, new int[] { 8 });
+
+ // test project #2:
+ unit = fragment2.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
+ " }\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
+ " }\n" +
+ "}\n",
+ true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
+ reconciled = unit.reconcile(getJLS8(), true, null, new NullProgressMonitor());
+ problems = reconciled.getProblems();
+ assertProblems(problems, new String[] {
+ "Pb(912) Null type safety: The expression of type 'String' needs unchecked conversion to conform to '@NonNull String'",
+ "Pb(912) Null type safety: The expression of type 'String' needs unchecked conversion to conform to '@NonNull String'",
+ }, new int[] { 8, 11 });
+ } finally {
+ if (prj2 != null)
+ prj2.getProject().delete(true, true, null);
+ }
+ }
+
+ // same as above but swapped order
+ public void testTwoProjects_b() throws Exception {
+ IJavaProject prj2 = null;
+ try {
+ // create project #1:
+ myCreateJavaProject("TestLibs1");
+ addLibraryWithExternalAnnotations(this.project, "lib1.jar", "/TestLibs1", new String[] {
+ "/UnannotatedLib/libs/Lib1.java",
+ "package libs;\n" +
+ "\n" +
+ "public class Lib1 {\n" +
+ " public static String one = \"1\";\n" + // not final!
+ " public static String none = null;\n" +
+ "}\n"
+ }, null);
+ createFileInProject("libs", "Lib1.eea",
+ "class libs/Lib1\n" +
+ "\n" +
+ "one\n" +
+ " Ljava/lang/String;\n" +
+ " L1java/lang/String;\n" +
+ "\n" +
+ "none\n" +
+ " Ljava/lang/String;\n" +
+ " L0java/lang/String;\n" +
+ "\n");
+ IPackageFragment fragment1 = this.project.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
+
+ // create project #2 (referring to the same lib, but without external annotations):
+ prj2 = createJavaProject("TestLibs2", new String[]{"src"}, new String[]{this.jclLib, "/TestLibs1/lib1.jar"}, null, null, "bin", null, null, null, this.compliance);
+ addLibraryEntry(prj2, this.ANNOTATION_LIB, false);
+ Map<String,String> options = prj2.getOptions(true);
+ options.put(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED);
+ prj2.setOptions(options);
+ IPackageFragment fragment2 = prj2.getPackageFragmentRoots()[0].createPackageFragment("tests", true, null);
+
+ // test project #2:
+ ICompilationUnit unit = fragment2.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
+ " }\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
+ " }\n" +
+ "}\n",
+ true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
+ CompilationUnit reconciled = unit.reconcile(getJLS8(), true, null, new NullProgressMonitor());
+ IProblem[] problems = reconciled.getProblems();
+ assertProblems(problems, new String[] {
+ "Pb(912) Null type safety: The expression of type 'String' needs unchecked conversion to conform to '@NonNull String'",
+ "Pb(912) Null type safety: The expression of type 'String' needs unchecked conversion to conform to '@NonNull String'",
+ }, new int[] { 8, 11 });
+
+
+ // test project #1:
+ unit = fragment1.createCompilationUnit("Test1.java",
+ "package tests;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "import libs.Lib1;\n" +
+ "\n" +
+ "public class Test1 {\n" +
+ " @NonNull String test0() {\n" +
+ " return Lib1.none;\n" +
+ " }\n" +
+ " @NonNull String test1() {\n" +
+ " return Lib1.one;\n" +
+ " }\n" +
+ "}\n",
+ true, new NullProgressMonitor()).getWorkingCopy(new NullProgressMonitor());
+ reconciled = unit.reconcile(getJLS8(), true, null, new NullProgressMonitor());
+ problems = reconciled.getProblems();
+ assertProblems(problems, new String[] {
+ "Pb(933) Null type mismatch: required '@NonNull String' but the provided value is specified as @Nullable",
+ }, new int[] { 8 });
+ } finally {
+ if (prj2 != null)
+ prj2.getProject().delete(true, true, null);
+ }
+ }
+
/** Reconcile an individual CU. */
public void test1Reconcile() throws Exception {
setupJavaProject("Test1");
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java
index 420e391..b205d76 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ExternalAnnotations18Test.java
@@ -115,12 +115,6 @@
return false;
}
}
-
- static IClasspathAttribute[] externalAnnotationExtraAttributes(String path) {
- return new IClasspathAttribute[] {
- new ClasspathAttribute(IClasspathAttribute.EXTERNAL_ANNOTATION_PATH, path)
- };
- }
static class LogListener implements ILogListener {
List<IStatus> loggedStatus = new ArrayList<>();
@@ -271,23 +265,9 @@
super.tearDown();
}
- protected void addLibraryWithExternalAnnotations(
- IJavaProject javaProject,
- String jarName,
- String externalAnnotationPath,
- String[] pathAndContents,
- Map options) throws CoreException, IOException
- {
- createLibrary(javaProject, jarName, "src.zip", pathAndContents, null, this.compliance, options);
- String jarPath = '/' + javaProject.getProject().getName() + '/' + jarName;
- IClasspathEntry entry = JavaCore.newLibraryEntry(
- new Path(jarPath),
- new Path('/'+javaProject.getProject().getName()+"/src.zip"),
- null/*src attach root*/,
- null/*access rules*/,
- externalAnnotationExtraAttributes(externalAnnotationPath),
- false/*exported*/);
- addClasspathEntry(this.project, entry);
+ protected void addLibraryWithExternalAnnotations(IJavaProject javaProject, String jarName, String externalAnnotationPath,
+ String[] pathAndContents, Map options) throws CoreException, IOException {
+ addLibraryWithExternalAnnotations(javaProject, this.compliance, jarName, externalAnnotationPath, pathAndContents, options);
}
protected void addProjectDependencyWithExternalAnnotations(
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Java9ElementTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Java9ElementTests.java
index ed654f7..867bf7a 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Java9ElementTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/Java9ElementTests.java
@@ -869,7 +869,7 @@
assertTrue("Invalid selection result", (elements[0] instanceof BinaryModule));
IModuleDescription mod = (IModuleDescription) elements[0];
String id = mod.getHandleIdentifier();
- assertTrue("incorrect id", id.matches("=Java9Elements/.*"+Pattern.quote("\\/jmods\\/java.base.jmod<'`java.base")));
+ assertTrue("incorrect id", id.matches("=Java9Elements/.*"+Pattern.quote("\\/jmods\\/java.base.jmod=/module=/true<'`java.base")));
IJavaElement element = JavaCore.create(id);
assertEquals("incorrect element type", IJavaElement.JAVA_MODULE, element.getElementType());
assertEquals("incorrect module name", "java.base", element.getElementName());
@@ -1379,7 +1379,6 @@
IPackageFragment pkg = (IPackageFragment) parent;
IPackageFragmentRoot root = (IPackageFragmentRoot) pkg.getParent();
String id = root.getHandleIdentifier();
- System.out.println(id);
assertTrue("incorrect id", id.matches("=Java9Elements/work\\\\/src\\\\/java"));
IJavaElement element = JavaCore.create(id);
assertEquals("incorrect element type", IJavaElement.PACKAGE_FRAGMENT_ROOT, element.getElementType());
@@ -1605,7 +1604,7 @@
assertTrue("Invalid selection result", (elements[0] instanceof BinaryModule));
IModuleDescription mod = (IModuleDescription) elements[0];
String id = mod.getHandleIdentifier();
- assertEquals("identifier", "=Java9Elements/"+jdkRootPath.toString().replace("/", "\\/")+"\\/jmods\\/java.base.jmod<'`java.base", id);
+ assertEquals("identifier", "=Java9Elements/"+jdkRootPath.toString().replace("/", "\\/")+"\\/jmods\\/java.base.jmod=/module=/true<'`java.base", id);
ISourceRange ir =mod.getNameRange();
assertTrue("positive offset", ir.getOffset() > 0);
assertEquals("length", 9, ir.getLength());
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java
index 65b052d..0567191 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaModelManagerTests.java
@@ -23,11 +23,17 @@
import org.eclipse.jdt.internal.core.JavaElement;
import org.eclipse.jdt.internal.core.nd.indexer.Indexer;
+import junit.framework.Test;
+
public class JavaModelManagerTests extends AbstractJavaModelTests {
private static final IProgressMonitor NULL_MONITOR = new NullProgressMonitor();
private static final String PROJECT_NAME = JavaModelManagerTests.class.getSimpleName();
+ public static Test suite() {
+ return buildModelTestSuite(JavaModelManagerTests.class);
+ }
+
public JavaModelManagerTests(String name) {
super(name);
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
index 765a045..5e0199c 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann <stephan@cs.tu-berlin.de> - inconsistent initialization of classpath container backed by external class folder, see https://bugs.eclipse.org/320618
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs13Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs13Tests.java
index c0f0e30..0c932c7 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs13Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs13Tests.java
@@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java
index 94c10f5..2133ba2 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/MementoTests.java
@@ -14,6 +14,7 @@
package org.eclipse.jdt.core.tests.model;
import java.io.File;
+import java.io.IOException;
import org.eclipse.core.resources.*;
import org.eclipse.core.runtime.CoreException;
@@ -75,6 +76,9 @@
protected String getEscapedExternalJCLPath() {
return getEscapedPath(getExternalJCLPath().toString());
}
+String getEscapedJrtJarPath() {
+ return getEscapedPath(System.getProperty("java.home")+"/lib/jrt-fs.jar");
+}
protected String getEscapedPath(String path) {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < path.length(); i++) {
@@ -808,4 +812,95 @@
IPackageFragmentRoot newRoot = (IPackageFragmentRoot) JavaCore.create(handleIdentifier);
assertEquals(root, newRoot);
}
+public void testAnnotationPath18() throws CoreException, IOException {
+ // tests annotationpath in memento for a regular jar library:
+ try {
+ IJavaProject project = createJavaProject("Test", new String[] {"src"}, null, "bin", "1.8", false);
+ addLibraryWithExternalAnnotations(project, "1.8", "lib.jar", "/Test/annots",
+ new String[] {
+ "test/Test.java",
+ "package test;\n" +
+ "public class Test{}\n"
+ },
+ null);
+ String[] expectedIdentifiers = {
+ "=Test/src",
+ "=Test/lib.jar=/annotationpath=/\\/Test\\/annots"
+ };
+ IPackageFragmentRoot[] roots = project.getPackageFragmentRoots();
+ boolean archiveSeen = false;
+ for (int i = 0; i < roots.length; i++) {
+ // JarPackageFragmentRoot
+ IPackageFragmentRoot packageRoot = roots[i];
+ String handleIdentifier = packageRoot.getHandleIdentifier();
+ assertEquals("Root mementos", expectedIdentifiers[i], handleIdentifier);
+ IJavaElement element = JavaCore.create(handleIdentifier, null);
+ assertEquals("Root equivalence", packageRoot, element);
+ if (packageRoot.isArchive()) {
+ archiveSeen = true;
+ // PackageFragment
+ IPackageFragment test = packageRoot.getPackageFragment("test");
+ handleIdentifier = test.getHandleIdentifier();
+ String expected = expectedIdentifiers[i]+"<test";
+ assertEquals("PackageFragment mementos", expected, handleIdentifier);
+ element = JavaCore.create(handleIdentifier, null);
+ assertEquals("PackageFragment equivalence", test, element);
+ // ClassFile:
+ IClassFile classFile = test.getClassFile("Test.class");
+ handleIdentifier = classFile.getHandleIdentifier();
+ assertEquals("ClassFile mementos", expected+"(Test.class", handleIdentifier);
+ element = JavaCore.create(handleIdentifier);
+ assertEquals("ClassFile equivalence", classFile, element);
+ }
+ }
+ assertTrue("Should have seen an archive", archiveSeen);
+ } finally {
+ deleteProject("Test");
+ }
+}
+public void testAnnotationPath9() throws CoreException, IOException {
+ // tests annotationpath & add-exports in memento for a jrt system library:
+ if (!isJRE9) return;
+ try {
+ IClasspathAttribute[] annPathAttr = {
+ JavaCore.newClasspathAttribute(IClasspathAttribute.EXTERNAL_ANNOTATION_PATH, "annots"),
+ JavaCore.newClasspathAttribute(IClasspathAttribute.ADD_EXPORTS, "jdk.rmic/sun.rmi.rmic=ALL-UNNAMED")
+ };
+ IJavaProject project = createJava9ProjectWithJREAttributes("Test", new String[] {"src"}, annPathAttr);
+ String attributesMemento = "=/annotationpath=/annots=/add-exports=/jdk.rmic\\/sun.rmi.rmic\\=ALL-UNNAMED";
+
+ // Module java.base:
+ String expectedIdentifier = "=Test/"+getEscapedJrtJarPath()+"`java.base"+attributesMemento; // for specific PFR (see below)
+ IModuleDescription module = project.findModule("java.base", null);
+ String moduleIdentifier = expectedIdentifier+"<'`java.base"; // PFR - PackageFragment - ModularClassFile - Module
+ assertEquals("Module mementos", moduleIdentifier, module.getHandleIdentifier());
+ IJavaElement module2 = JavaCore.create(module.getHandleIdentifier(), null);
+ assertTrue("Module existence", module2.exists());
+ assertEquals("Module equivalence", module, module2);
+
+ // JrtPackageFragmentRoot - for module java.base:
+ IPackageFragmentRoot packageRoot = (IPackageFragmentRoot) module.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+ String handleIdentifier = packageRoot.getHandleIdentifier();
+ assertEquals("Root mementos", expectedIdentifier, handleIdentifier);
+ IJavaElement element = JavaCore.create(handleIdentifier, null);
+ assertEquals("Root equivalence", packageRoot, element);
+
+ // PackageFragment
+ IPackageFragment test = packageRoot.getPackageFragment("java.lang");
+ handleIdentifier = test.getHandleIdentifier();
+ String expected = expectedIdentifier+"<java.lang";
+ assertEquals("PackageFragment mementos", expected, handleIdentifier);
+ element = JavaCore.create(handleIdentifier, null);
+ assertEquals("PackageFragment equivalence", test, element);
+
+ // ClassFile:
+ IClassFile classFile = test.getClassFile("Object.class");
+ handleIdentifier = classFile.getHandleIdentifier();
+ assertEquals("ClassFile mementos", expected+"(Object.class", handleIdentifier);
+ element = JavaCore.create(handleIdentifier);
+ assertEquals("ClassFile equivalence", classFile, element);
+ } finally {
+ deleteProject("Test");
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NullAnnotationModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NullAnnotationModelTests.java
index 7a9a19d..7dbfd9d 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NullAnnotationModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/NullAnnotationModelTests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* Stephan Herrmann - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
index 022d22b..316dcce 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - adapted for Object Teams
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 b49ffdc..02e1bd6 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
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Copy-adjusted structure from ReconcilerTests, filled with new content
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests10.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests10.java
new file mode 100644
index 0000000..85b76d0
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests10.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2016, 2019 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.core.tests.model;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.WorkingCopyOwner;
+import org.eclipse.jdt.internal.core.LocalVariable;
+
+import junit.framework.Test;
+
+public class ResolveTests10 extends AbstractJavaModelTests {
+ ICompilationUnit wc = null;
+
+ static {
+// TESTS_NAMES = new String[] { "testModuleInfo_" };
+// TESTS_NUMBERS = new int[] { 124 };
+// TESTS_RANGE = new int[] { 16, -1 };
+ }
+ public static Test suite() {
+ return buildModelTestSuite(ResolveTests10.class);
+ }
+ public ResolveTests10(String name) {
+ super(name);
+ }
+ public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
+ return super.getWorkingCopy(path, source, this.wcOwner);
+ }
+ public void setUpSuite() throws Exception {
+ super.setUpSuite();
+
+ IJavaProject project = setUpJavaProject("Resolve", "10", true);
+
+ String bootModPath = System.getProperty("java.home") + File.separator +"jrt-fs.jar";
+ IClasspathEntry jrtEntry = JavaCore.newLibraryEntry(new Path(bootModPath), null, null, null, null, false);
+ IClasspathEntry[] old = project.getRawClasspath();
+ IClasspathEntry[] newPath = new IClasspathEntry[old.length +1];
+ System.arraycopy(old, 0, newPath, 0, old.length);
+ newPath[old.length] = jrtEntry;
+ project.setRawClasspath(newPath, null);
+
+ waitUntilIndexesReady();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.wcOwner = new WorkingCopyOwner(){};
+ }
+ public void tearDownSuite() throws Exception {
+ deleteProject("Resolve");
+
+ super.tearDownSuite();
+ }
+
+ protected void tearDown() throws Exception {
+ if (this.wc != null) {
+ this.wc.discardWorkingCopy();
+ }
+ super.tearDown();
+ }
+ public void testVarWithIntersectionType() throws CoreException {
+ this.wc = getWorkingCopy(
+ "/Resolve/src/Hey.java",
+ "interface Cloneable {}\n" +
+ "\n" +
+ "abstract class AbstractSet<S> {}\n" +
+ "\n" +
+ "class TreeSet<E> extends AbstractSet<E>\n" +
+ " implements Cloneable, java.io.Serializable\n" +
+ "{}\n" +
+ "\n" +
+ "class HashSet<E>\n" +
+ " extends AbstractSet<E>\n" +
+ " implements Cloneable, java.io.Serializable\n" +
+ "{}\n" +
+ "\n" +
+ "public class Hey {\n" +
+ " public static void main(String[] args) {\n" +
+ " var x = args.length > 0 ? new TreeSet<>() : new HashSet<>();\n" +
+ " x.add(1);\n" +
+ " }\n" +
+ "}\n");
+
+ String str = this.wc.getSource();
+ String selection = "x";
+ int start = str.lastIndexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.wc.codeSelect(start, length);
+ assertElementsEqual(
+ "Unexpected elements",
+ "x [in main(String[]) [in Hey [in [Working copy] Hey.java [in <default> [in src [in Resolve]]]]]]",
+ elements
+ );
+
+ String typeSignature = ((LocalVariable)elements[0]).getTypeSignature();
+ assertEquals("type signature", "&LAbstractSet<Ljava.lang.Object;>;:LCloneable;:Ljava.io.Serializable;", typeSignature);
+
+ assertStringsEqual(
+ "Unexpected intersection type bounds",
+ "LAbstractSet<Ljava.lang.Object;>;\n" +
+ "LCloneable;\n" +
+ "Ljava.io.Serializable;\n",
+ Signature.getUnionTypeBounds(typeSignature) // method name is wrong, it actually means: getIntersectionTypeBounds
+ );
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java
index 76d9708..823eb1e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/TypeResolveTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1478,6 +1478,33 @@
deleteProject("P");
}
}
+public void testBug533884b_blockless() throws Exception {
+ if (!isJRE9) return;
+ try {
+ createJava10Project("P", new String[] {"src"});
+ String source = "package p;\n" +
+ "public class X {\n" +
+ " void bar() {\n" +
+ " String[] x = {\"a\", \"b\"};\n" +
+ " for (var y : x) \n" +
+ " System.err.println(y.toUpperCase());\n" + // <= select this occurrence of 'y'
+ " }\n" +
+ "\n"
+ + "}\n";
+ createFolder("/P/src/p");
+ createFile("/P/src/p/X.java", source);
+ waitForAutoBuild();
+
+ ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java");
+ String select = "y";
+ IJavaElement[] elements = unit.codeSelect(source.lastIndexOf(select), select.length());
+ assertEquals("should not be empty", 1, elements.length);
+ ILocalVariable variable = (ILocalVariable) elements[0];
+ assertEquals("incorrect type", "Ljava.lang.String;", variable.getTypeSignature());
+ } finally {
+ deleteProject("P");
+ }
+}
public void testBug533884c() throws Exception {
try {
createJava10Project("P", new String[] {"src"});
@@ -1508,6 +1535,35 @@
deleteProject("P");
}
}
+public void testBug533884c_blockless() throws Exception {
+ try {
+ createJava10Project("P", new String[] {"src"});
+ String source = "package p;\n" +
+ "import java.io.*;\n" +
+ "public class X {\n" +
+ " void bar(File file) {\n" +
+ " try (var rc = new FileInputStream(file))\n" +
+ " System.err.println(rc.read());\n" + // <= select this occurrence of 'rc'
+ " }\n" +
+ "\n"
+ + "}\n";
+ createFolder("/P/src/p");
+ createFile("/P/src/p/X.java", source);
+ waitForAutoBuild();
+
+ ICompilationUnit unit = getCompilationUnit("/P/src/p/X.java");
+ String select = "rc";
+ IJavaElement[] elements = unit.codeSelect(source.lastIndexOf(select), select.length());
+ assertEquals("should not be empty", 1, elements.length);
+ ILocalVariable variable = (ILocalVariable) elements[0];
+ if (isJRE9)
+ assertEquals("incorrect type", "Ljava.io.FileInputStream;", variable.getTypeSignature());
+ else
+ assertEquals("incorrect type", "LFileInputStream;", variable.getTypeSignature()); // unresolved because JRT lib not available
+ } finally {
+ deleteProject("P");
+ }
+}
public void testBug536387() throws Exception {
try {
createJava11Project("P", new String[] {"src"});
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
index 2406a51..26fe652 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
index 95464da..228b887 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchExpressionsTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -306,9 +302,7 @@
buf.append(" int z = 100;\n");
buf.append(" break z;\n");
buf.append(" }\n");
- buf.append(" case 100, 200 -> {\n");
- buf.append(" break 2048;\n");
- buf.append("}\n");
+ buf.append(" case 100, 200 -> {break 2048;}\n");
buf.append(" default -> {\n");
buf.append(" break 12;\n");
buf.append(" }\n");
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
index 1b2a7a7..4a2fb22 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java
index dd32ff1..d0eb23b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ImportRewriteTest.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for Bug 378024 - Ordering of comments between imports not preserved
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
index 022a2a4..f5f3fac 100644
--- a/org.eclipse.jdt.core/.settings/.api_filters
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -1,20 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jdt.core" version="2">
- <resource path="META-INF/MANIFEST.MF">
- <filter comment="BETA_JAVA13 - temporary service segment bumping - to merge with master later (4.14)" id="924844039">
- <message_arguments>
- <message_argument value="3.18.50"/>
- <message_argument value="3.18.0"/>
- </message_arguments>
- </filter>
- </resource>
<resource path="compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java" type="org.eclipse.jdt.core.compiler.CategorizedProblem">
- <filter comment="To be addressed while merging 12" id="336658481">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.CategorizedProblem"/>
- <message_argument value="CAT_COMPLIANCE"/>
- </message_arguments>
- </filter>
<filter comment="PREVIEW RELATED" id="336658481">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.compiler.CategorizedProblem"/>
@@ -30,13 +16,6 @@
<message_argument value="4194303"/>
</message_arguments>
</filter>
- <filter id="388194388">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.compiler.IProblem"/>
- <message_argument value="IgnoreCategoriesMask"/>
- <message_argument value="8388607"/>
- </message_arguments>
- </filter>
</resource>
<resource path="dom/org/eclipse/jdt/core/dom/ASTVisitor.java" type="org.eclipse.jdt.core.dom.ASTVisitor">
<filter comment="Not required as it is a part of preview feature" id="338944126">
@@ -59,6 +38,12 @@
<message_argument value="isImplicit()"/>
</message_arguments>
</filter>
+ <filter comment="preview feature - transient" id="338944126">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.BreakStatement"/>
+ <message_argument value="propertyDescriptors(int, boolean)"/>
+ </message_arguments>
+ </filter>
<filter comment="Not valid for Java 13" id="338944126">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.dom.BreakStatement"/>
@@ -99,6 +84,12 @@
<message_argument value="propertyDescriptors(int)"/>
</message_arguments>
</filter>
+ <filter comment="preview feature - transient" id="338944126">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.SwitchExpression"/>
+ <message_argument value="propertyDescriptors(int, boolean)"/>
+ </message_arguments>
+ </filter>
<filter comment="No more an API as part of preview feature" id="338944126">
<message_arguments>
<message_argument value="org.eclipse.jdt.core.dom.SwitchExpression"/>
@@ -112,12 +103,4 @@
</message_arguments>
</filter>
</resource>
- <resource path="model/org/eclipse/jdt/core/util/IClassFileReader.java" type="org.eclipse.jdt.core.util.IClassFileReader">
- <filter comment="default method added for getting nest members" id="404000815">
- <message_arguments>
- <message_argument value="org.eclipse.jdt.core.util.IClassFileReader"/>
- <message_argument value="getNestMembersAttribute()"/>
- </message_arguments>
- </filter>
- </resource>
</component>
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index 9783158..4611c49 100644
--- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.19.50.OTDT_r275_qualifier
+Bundle-Version: 3.20.0.OTDT_r276_qualifier
Bundle-Activator: org.eclipse.jdt.core.JavaCore
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java
index 0709ad5..c3a28d0 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java
@@ -43,6 +43,7 @@
public class ClasspathJep247Jdk12 extends ClasspathJep247 {
Map<String, IModule> modules;
+ static String MODULE_INFO = "module-info.sig"; //$NON-NLS-1$
public ClasspathJep247Jdk12(File jdkHome, String release, AccessRuleSet accessRuleSet) {
super(jdkHome, release, accessRuleSet);
@@ -173,9 +174,8 @@
public FileVisitResult visitFile(java.nio.file.Path f, BasicFileAttributes attrs) throws IOException {
if (attrs.isDirectory() || f.getNameCount() < 3)
return FileVisitResult.CONTINUE;
- byte[] content = null;
- if (Files.exists(f)) {
- content = JRTUtil.safeReadBytes(f);
+ if (f.getFileName().toString().equals(MODULE_INFO) && Files.exists(f)) {
+ byte[] content = JRTUtil.safeReadBytes(f);
if (content == null)
return FileVisitResult.CONTINUE;
Path m = f.subpath(1, f.getNameCount() - 1);
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index aa48467..6c761c7 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -34,7 +34,7 @@
###{ObjectTeams:
otdtc.name = Extension for Object Teams
-otdtc.version = 2.7.4
+otdtc.version = 2.7.6
otdtc.copyright = Copyright by TU Berlin, Fraunhofer FIRST and others, 2004, 2019.
### SH}
### progress
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index 63de5fb..bca0bd1 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index 483d27f..5d069a0 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
index 2b72b49..8d3bef1 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java
index e5785f7..c162e3e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -112,7 +108,7 @@
*/
public static final int CAT_COMPLIANCE = 170;
/** Category for problems related to preview features
- * @since 3.19 BETA_JAVA13*/
+ * @since 3.20*/
public static final int CAT_PREVIEW_RELATED = 180;
/**
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
index b00a8f3..8e0bd49 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* IBM Corporation - added the following constants
@@ -383,7 +379,7 @@
int ModuleRelated = 0x00800000;
/** @since 3.18 */
int Compliance = 0x00400000;
- /** @since 3.19 BETA_JAVA13 */
+ /** @since 3.20 */
int PreviewRelated = 0x00200000;
/**
@@ -784,7 +780,7 @@
/** @since 3.10 */
int MissingTypeInLambda = MethodRelated + 271;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int UnterminatedTextBlock = PreviewRelated + 272;
// type related problems
@@ -1817,6 +1813,8 @@
int RedundantNullDefaultAnnotationModule = Internal + 943;
/** @since 3.19 */
int RedundantNullCheckOnConstNonNullField = Internal + 944;
+ /** @since 3.20 */
+ int ConstNonNullFieldComparisonYieldsFalse = Internal + 945;
/** @since 3.10 */
int ArrayReferencePotentialNullReference = Internal + 951;
@@ -2074,7 +2072,7 @@
int PreviewFeatureUsed = Compliance + 1104;
/** @since 3.18 */
int PreviewFeatureNotSupported = Compliance + 1105;
- /** @since 3.19 BETA_JAVA13*/
+ /** @since 3.20*/
int PreviewFeaturesNotAllowed = PreviewRelated + 1106;
/** @since 3.13 */
@@ -2613,61 +2611,61 @@
* @deprecated preview related error - will be removed
* @noreference preview related error */
int SwitchExpressionIllegalLastStatement = Internal + 1612;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldIncompatibleResultExpressionTypes = PreviewRelated + 1700;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldEmptySwitchBlock = PreviewRelated + 1701;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldNoResultExpression = PreviewRelated + 1702;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionaYieldSwitchLabeledBlockCompletesNormally = PreviewRelated + 1703;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldLastStatementCompletesNormally = PreviewRelated + 1704;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldTrailingSwitchLabels = PreviewRelated + 1705;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchPreviewMixedCase = PreviewRelated + 1706;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldMissingDefaultCase = PreviewRelated + 1707;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldMissingValue = PreviewRelated + 1708;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldMissingEnumConstantCase = PreviewRelated + 1709;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldIllegalLastStatement = PreviewRelated + 1710;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldBreakNotAllowed = PreviewRelated + 1711;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldUnqualifiedMethodWarning = PreviewRelated + 1712;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldUnqualifiedMethodError = PreviewRelated + 1713;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldOutsideSwitchExpression = PreviewRelated + 1714;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldRestrictedGeneralWarning = PreviewRelated + 1715;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldIllegalStatement = PreviewRelated + 1716;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldTypeDeclarationWarning = PreviewRelated + 1717;
- /** @since 3.19 BETA_JAVA13
+ /** @since 3.20
* @noreference preview related error */
int SwitchExpressionsYieldTypeDeclarationError = PreviewRelated + 1718;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
index 6a5669c..3d4378f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java
index fdb1e3b..022b20a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java
@@ -82,6 +82,13 @@
public abstract void reset();
/**
+ * Final cleanup after all rounds have completed.
+ */
+ protected void cleanUp() {
+ // default: do nothing, because reset() already did the common work
+ }
+
+ /**
* Run a new annotation processing round on the given values.
*
* @param units the given source type
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
index 62b15cc..dcc0faf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -5949,10 +5949,14 @@
case 'S':
return index;
default:
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(methodSignature, index);
}
}
+ private static IllegalArgumentException newIllegalArgumentException(char[] string, int index) {
+ return new IllegalArgumentException("\"" + String.valueOf(string) + "\" at " + index); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
/**
* INTERNAL USE-ONLY
* This methods leaves the space for method counts recording.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
index ffe3dc6..620a941 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java
@@ -1012,6 +1012,14 @@
}
protected void processAnnotations() {
+ try {
+ processAnnotationsInternal();
+ } finally {
+ this.annotationProcessorManager.cleanUp();
+ }
+ }
+
+ private void processAnnotationsInternal() {
int newUnitSize = 0;
int newClassFilesSize = 0;
int bottom = this.annotationProcessorStartIndex;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java
index 2c51d87..e12cfc4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
index 9d8fa99..6d26fa3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Nick Teryaev - fix for bug (https://bugs.eclipse.org/bugs/show_bug.cgi?id=40752)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
index a0cf2cf..18249ba 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java
@@ -313,7 +313,10 @@
this.breaksOut = true;
return false;
}
-
+ @Override
+ public boolean visit(YieldStatement yieldStatement, BlockScope skope) {
+ return false;
+ }
public boolean breaksOut() {
Statement.this.traverse(this, null);
return this.breaksOut;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
index 7b3e80f..b524448 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java
@@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
index 019f5ee..3fe7de0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contributions for
@@ -129,6 +125,7 @@
}
SwitchFlowContext switchContext =
new SwitchFlowContext(flowContext, this, (this.breakLabel = new BranchLabel()), true, true);
+ switchContext.isExpression = this instanceof SwitchExpression;
// analyse the block by considering specially the case/default statements (need to bind them
// to the entry point)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TextBlock.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TextBlock.java
index 6c3d50e..a4e8a57 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TextBlock.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TextBlock.java
@@ -7,10 +7,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
index 45f53a6..1e74d0d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java
@@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
index 5a6860f..eb17e5f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java
@@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java
index 0e8962b..3479ca6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -44,8 +40,12 @@
// to each of the traversed try statements, so that execution will terminate properly.
- // lookup the null label, this should answer the returnContext
- FlowContext targetContext = flowContext.getTargetContextForDefaultBreak();
+ // lookup the null label, this should answer the returnContext - for implicit yields, the nesting
+ // doesn't occur since it immediately follow '->' and hence identical to default break - ie the
+ // immediate breakable context is guaranteed to be the one intended;
+ // while explicit yield should move up the parent to the switch expression.
+ FlowContext targetContext = this.isImplicit ? flowContext.getTargetContextForDefaultBreak() :
+ flowContext.getTargetContextForDefaultYield();
flowInfo = this.expression.analyseCode(currentScope, flowContext, flowInfo);
this.expression.checkNPEbyUnboxing(currentScope, flowContext, flowInfo);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
index 4ab724e..3c9e274 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
index 4d99f72..3d73bad 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java
@@ -616,6 +616,24 @@
// not found
return null;
}
+/*
+ * lookup a default yield through switch expression locations
+ */
+public FlowContext getTargetContextForDefaultYield() {
+ FlowContext current = this, lastNonReturningSubRoutine = null;
+ while (current != null) {
+ if (current.isNonReturningContext()) {
+ lastNonReturningSubRoutine = current;
+ }
+ if (current.isBreakable() && current.labelName() == null && ((SwitchFlowContext) current).isExpression){
+ if (lastNonReturningSubRoutine == null) return current;
+ return lastNonReturningSubRoutine;
+ }
+ current = current.getLocalParent();
+ }
+ // not found
+ return null;
+}
/*
* lookup a default continue amongst continuable locations
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java
index 363c863..fb2bfa9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2017 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -26,6 +26,7 @@
public BranchLabel breakLabel;
public UnconditionalFlowInfo initsOnBreak = FlowInfo.DEAD_END;
+ public boolean isExpression = false;
public SwitchFlowContext(FlowContext parent, ASTNode associatedNode, BranchLabel breakLabel, boolean isPreTest, boolean inheritNullFieldChecks) {
super(parent, associatedNode, inheritNullFieldChecks);
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 9a3f867..7d9fa4f 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
@@ -294,6 +294,8 @@
public static final String OPTION_EnablePreviews = "org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures"; //$NON-NLS-1$
public static final String OPTION_ReportPreviewFeatures = "org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures"; //$NON-NLS-1$
+ public static final String OPTION_ReportSuppressWarningNotFullyAnalysed = "org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed"; //$NON-NLS-1$
+
// Internally used option to allow debug framework compile evaluation snippets in context of modules, see bug 543604
public static final String OPTION_JdtDebugCompileMode = "org.eclipse.jdt.internal.debug.compile.mode"; //$NON-NLS-1$
@@ -433,6 +435,7 @@
public static final int APILeak = IrritantSet.GROUP2 | ASTNode.Bit25;
public static final int UnstableAutoModuleName = IrritantSet.GROUP2 | ASTNode.Bit26;
public static final int PreviewFeatureUsed = IrritantSet.GROUP2 | ASTNode.Bit27;
+ public static final int SuppressWarningsNotAnalysed = IrritantSet.GROUP2 | ASTNode.Bit28;
//{ObjectTeams: OT/J specific problems/irritants:
@@ -973,6 +976,8 @@
return OPTION_ReportUnstableAutoModuleName;
case PreviewFeatureUsed:
return OPTION_ReportPreviewFeatures;
+ case SuppressWarningsNotAnalysed:
+ return OPTION_ReportSuppressWarningNotFullyAnalysed;
}
return null;
}
@@ -1237,7 +1242,8 @@
OPTION_ReportUnlikelyCollectionMethodArgumentType,
OPTION_ReportUnlikelyEqualsArgumentType,
OPTION_ReportAPILeak,
- OPTION_ReportPreviewFeatures
+ OPTION_ReportPreviewFeatures,
+ OPTION_ReportSuppressWarningNotFullyAnalysed
};
return result;
}
@@ -1727,6 +1733,7 @@
optionsMap.put(OPTION_ReportUnstableAutoModuleName, getSeverityString(UnstableAutoModuleName));
optionsMap.put(OPTION_EnablePreviews, this.enablePreviewFeatures ? ENABLED : DISABLED);
optionsMap.put(OPTION_ReportPreviewFeatures, getSeverityString(PreviewFeatureUsed));
+ optionsMap.put(OPTION_ReportSuppressWarningNotFullyAnalysed, getSeverityString(SuppressWarningsNotAnalysed));
return optionsMap;
}
@@ -2505,6 +2512,8 @@
}
if ((optionValue = optionsMap.get(OPTION_ReportPreviewFeatures)) != null)
updateSeverity(PreviewFeatureUsed, optionValue);
+ if ((optionValue = optionsMap.get(OPTION_ReportSuppressWarningNotFullyAnalysed)) != null)
+ updateSeverity(SuppressWarningsNotAnalysed, optionValue);
if ((optionValue = optionsMap.get(OPTION_JdtDebugCompileMode)) != null) {
if (ENABLED.equals(optionValue)) {
@@ -2653,6 +2662,7 @@
buf.append("\n\t- unlikely argument types for equals(): ").append(getSeverityString(UnlikelyEqualsArgumentType)); //$NON-NLS-1$
buf.append("\n\t- API leak: ").append(getSeverityString(APILeak)); //$NON-NLS-1$
buf.append("\n\t- unstable auto module name: ").append(getSeverityString(UnstableAutoModuleName)); //$NON-NLS-1$
+ buf.append("\n\t- SuppressWarnings not fully analysed: ").append(getSeverityString(SuppressWarningsNotAnalysed)); //$NON-NLS-1$
//{ObjectTeams
buf.append("\n\t- decapsulation : ").append(this.decapsulation); //$NON-NLS-1$
buf.append("\n\t- report if not exactly one basecall in callin method : ").append(getSeverityString(NotExactlyOneBasecall)); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
index cf6ffed..82dd7ad 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -91,7 +91,7 @@
public static final IrritantSet PREVIEW = new IrritantSet(CompilerOptions.PreviewFeatureUsed);
public static final IrritantSet COMPILER_DEFAULT_ERRORS = new IrritantSet(0); // no optional error by default
public static final IrritantSet COMPILER_DEFAULT_WARNINGS = new IrritantSet(0); // see static initializer below
- public static final IrritantSet COMPILER_DEFAULT_INFOS = new IrritantSet(0); // As of now, no default values
+ public static final IrritantSet COMPILER_DEFAULT_INFOS = new IrritantSet(0); // see static initializer below
//{ObjectTeams: new irritants:
public static final IrritantSet NOT_EXACTLY_ONE_BASECALL = new IrritantSet(
CompilerOptions.NotExactlyOneBasecall);
@@ -142,7 +142,8 @@
COMPILER_DEFAULT_INFOS
// group-2 infos enabled by default
.set(
- CompilerOptions.UnlikelyEqualsArgumentType);
+ CompilerOptions.UnlikelyEqualsArgumentType
+ | CompilerOptions.SuppressWarningsNotAnalysed);
COMPILER_DEFAULT_WARNINGS
//{ObjectTeams: default to warning (group 3):
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
index 7ab09a4..28c87e4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java
@@ -834,6 +834,12 @@
*/
@Override
public FieldBinding getField(char[] fieldName, boolean needResolve) {
+ if (((this.tagBits & TagBits.AreFieldsComplete) == 0) && ((this.type.tagBits & TagBits.AreFieldsSorted) != 0)) {
+ // assume that completing fields is in progress
+ FieldBinding originalField = ReferenceBinding.binarySearch(fieldName, this.type.unResolvedFields());
+ if (originalField == null)
+ return null; // avoid useless, possibly premature resolving
+ }
fields(); // ensure fields have been initialized... must create all at once unlike methods
return ReferenceBinding.binarySearch(fieldName, this.fields);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
index c80749d..a56d61a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
@@ -8,10 +8,6 @@
#
# SPDX-License-Identifier: EPL-2.0
#
-# This is an implementation of an early-draft specification developed under the Java
-# Community Process (JCP) and is made available for testing and evaluation purposes
-# only. The code is not compatible with any specification of the JCP.
-#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
index 856ac43..dc3a9fb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - extended API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java
index b4b1ad2..96b25b8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -31,4 +27,5 @@
* appear as terminals in ModuleDeclaration, and are identifiers everywhere else)
*/
boolean isParsingModuleDeclaration();
+ boolean isParsingJava13();
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
index d73e3a9..ab214ef 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - extended API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
index 2921f0e..5af152a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Tom Tromey - patch for readTable(String) as described in http://bugs.eclipse.org/bugs/show_bug.cgi?id=32196
@@ -11638,7 +11634,7 @@
//if some declaration occurs.
this.nestedType--;
this.switchNestingLevel--;
-
+ this.scanner.breakPreviewAllowed = this.switchNestingLevel > 0;
int length;
SwitchStatement switchStatement = isStmt ? new SwitchStatement() : new SwitchExpression();
this.expressionLengthPtr--;
@@ -11860,12 +11856,12 @@
}
protected void consumeTextBlock() {
if (!this.parsingJava13Plus) {
- problemReporter().previewFeatureNotSupported(this.scanner.rawStart, this.scanner.currentPosition - 1, "Text Blocks", CompilerOptions.VERSION_13); //$NON-NLS-1$
+ problemReporter().previewFeatureNotSupported(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks", CompilerOptions.VERSION_13); //$NON-NLS-1$
} else if (!this.options.enablePreviewFeatures){
- problemReporter().previewFeatureNotEnabled(this.scanner.rawStart, this.scanner.currentPosition - 1, "Text Blocks"); //$NON-NLS-1$
+ problemReporter().previewFeatureNotEnabled(this.scanner.startPosition, this.scanner.currentPosition - 1, "Text Blocks"); //$NON-NLS-1$
} else {
if (this.options.isAnyEnabled(IrritantSet.PREVIEW)) {
- problemReporter().previewFeatureUsed(this.scanner.rawStart, this.scanner.currentPosition - 1);
+ problemReporter().previewFeatureUsed(this.scanner.startPosition, this.scanner.currentPosition - 1);
}
}
char[] textBlock2 = this.scanner.getCurrentTextBlock();
@@ -11985,18 +11981,6 @@
return true;
}
@Override
- public boolean visit(DoStatement stmt, BlockScope blockScope) {
- return false;
- }
- @Override
- public boolean visit(ForStatement stmt, BlockScope blockScope) {
- return false;
- }
- @Override
- public boolean visit(ForeachStatement stmt, BlockScope blockScope) {
- return false;
- }
- @Override
public boolean visit(SwitchStatement stmt, BlockScope blockScope) {
return false;
}
@@ -12004,14 +11988,6 @@
public boolean visit(TypeDeclaration stmt, BlockScope blockScope) {
return false;
}
- @Override
- public boolean visit(WhileStatement stmt, BlockScope blockScope) {
- return false;
- }
- @Override
- public boolean visit(CaseStatement caseStatement, BlockScope blockScope) {
- return true; // do nothing by default, keep traversing
- }
}
s.resultExpressions = new ArrayList<>(0); // indicates processed
int l = s.statements == null ? 0 : s.statements.length;
@@ -16847,6 +16823,10 @@
}
}
@Override
+public boolean isParsingJava13() {
+ return this.parsingJava13Plus;
+}
+@Override
public boolean isParsingModuleDeclaration() {
// It can be a null in case of a Vanguard parser, which means no module to be dealt with.
return (this.parsingJava9Plus && this.compilationUnit != null && this.compilationUnit.isModuleInfo());
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java
index 8c046cd..c4257c4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2015 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -110,4 +110,16 @@
return super.add(nestedBlockDeclaration, bracketBalanceValue);
}
}
+@Override
+public RecoveredElement add(Statement stmt, int bracketBalanceValue) {
+ if (this.statement instanceof ForeachStatement) {
+ ForeachStatement foreach = (ForeachStatement) this.statement;
+ if (foreach.action == null) {
+ // add the action to a block-less foreach, so that the action can see the for variable
+ foreach.action = stmt;
+ return this;
+ }
+ }
+ return super.add(stmt, bracketBalanceValue);
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index 7f0eeb8..e89f9fb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -299,21 +295,16 @@
public boolean fakeInModule = false;
boolean inCase = false;
/* package */ int yieldColons = -1;
+ boolean breakPreviewAllowed = false;
/**
* The current context of the scanner w.r.t restricted keywords
*
*/
enum ScanContext {
- EXPECTING_KEYWORD, EXPECTING_IDENTIFIER, AFTER_REQUIRES, EXPECTING_YIELD, INACTIVE
+ EXPECTING_KEYWORD, EXPECTING_IDENTIFIER, AFTER_REQUIRES, INACTIVE
}
protected ScanContext scanContext = null;
protected boolean insideModuleInfo = false;
-
- enum ScanYieldContext {
- EXPECTING_YIELD, FLAGGED_YIELD, INACTIVE
- }
- protected ScanYieldContext scanYieldContext = null;
- private int yieldStatementEnd = -1;
public static final String END_OF_SOURCE = "End_Of_Source"; //$NON-NLS-1$
public static final String INVALID_HEXA = "Invalid_Hexa_Literal"; //$NON-NLS-1$
@@ -787,7 +778,7 @@
return result;
}
protected final boolean scanForTextBlockBeginning() {
- if (!this.previewEnabled) {
+ if (this.activeParser != null && !this.activeParser.isParsingJava13()) {
return false;
}
try {
@@ -1513,8 +1504,10 @@
this.nextToken = unambiguousToken;
}
private void updateCase(int token) {
- if (token == TokenNamecase)
+ if (token == TokenNamecase) {
this.inCase = true;
+ this.breakPreviewAllowed = true;
+ }
if (token == TokenNameCOLON || token == TokenNameARROW)
this.inCase = false;
}
@@ -1569,8 +1562,6 @@
return this.currentPosition > this.eofPosition ? TokenNameEOF : TokenNameRBRACE;
}
int whiteStart = 0;
- if (this.currentPosition > this.yieldStatementEnd)
- this.yieldStatementEnd = -1;
try {
while (true) { //loop for jumping over comments
this.withoutUnicodePtr = 0;
@@ -2490,10 +2481,13 @@
return;
}
if (this.currentCharacter == '\r'){
- if (this.source[this.currentPosition] == '\n') this.currentPosition++;
+ // For text block, we don't want to overlook \n. Hence, don't advance past \n
+ //if (this.source[this.currentPosition] == '\n') this.currentPosition++;
break NextToken; // the string cannot go further that the line
}
if (this.currentCharacter == '\n'){
+ // For text block, we don't want to overlook \n. Hence, go back one char
+ this.currentPosition--;
break; // the string cannot go further that the line
}
if (this.currentCharacter == '\\') {
@@ -4803,7 +4797,7 @@
&& (data[++index] == 'e')
&& (data[++index] == 'l')
&& (data[++index] == 'd'))
- return disambiguatedRestrictedIdentifier(TokenNameRestrictedIdentifierYield);
+ return disambiguatedRestrictedIdentifierYield(TokenNameRestrictedIdentifierYield);
//$FALL-THROUGH$
default :
return TokenNameIdentifier;
@@ -5152,8 +5146,6 @@
resetOTFlags();
// SH}
this.scanContext = null;
- this.scanYieldContext = null;
- this.yieldStatementEnd = -1;
this.yieldColons = -1;
this.insideModuleInfo = false;
}
@@ -5843,6 +5835,9 @@
this.vanguardScanner.resetTo(this.startPosition, this.eofPosition - 1, isInModuleDeclaration(), this.scanContext);
return this.vanguardParser;
}
+protected final boolean mayBeAtBreakPreview() {
+ return this.breakPreviewAllowed && this.lookBack[1] != TokenNameARROW;
+}
protected final boolean maybeAtLambdaOrCast() { // Could the '(' we saw just now herald a lambda parameter list or a cast expression ? (the possible locations for both are identical.)
@@ -5966,6 +5961,7 @@
case TokenNameRPAREN:
case TokenNameSEMICOLON:
case TokenNameelse:
+ case TokenNamedo:
return true;
case TokenNameCOLON:
return this.lookBack[0] == TokenNamedefault || this.yieldColons == 1;
@@ -5975,37 +5971,81 @@
return false;
}
}
-int disambiguatedRestrictedIdentifier(int restrictedKeywordToken) {
- // and here's the kludge
- if (restrictedKeywordToken != TokenNameRestrictedIdentifierYield)
- return restrictedKeywordToken; // safety net - only yield processed here!
- if (!this.previewEnabled)
- return TokenNameIdentifier;
- if (this.scanYieldContext == ScanYieldContext.FLAGGED_YIELD) // nested yield implies identifier.
- return TokenNameIdentifier;
- if (this.scanYieldContext == ScanYieldContext.EXPECTING_YIELD) {
- this.scanYieldContext = ScanYieldContext.FLAGGED_YIELD; // producer/consumer: vanguard scanner
- return TokenNameRestrictedIdentifierYield;
- }
- if (this.currentPosition < this.yieldStatementEnd) //producer/consumer: current scanner [value from vanguard scanner]
- return TokenNameIdentifier; // don't bother until yieldStatementEnd
-
- if (this.sourceLevel < ClassFileConstants.JDK13)
- return TokenNameIdentifier;
-
- int token = TokenNameIdentifier;
-
- // not working - check intermittent parser rule definition possibility.
- final VanguardParser parser = getVanguardParser();
- if (restrictedKeywordToken == TokenNameRestrictedIdentifierYield && mayBeAtAnYieldStatement()) {
- parser.scanner.resetTo(this.startPosition, this.eofPosition - 1);
- parser.scanner.scanYieldContext = ScanYieldContext.EXPECTING_YIELD;
- if (parser.parse(Goal.YieldStatementGoal) == VanguardParser.SUCCESS) {
- this.yieldStatementEnd = parser.scanner.currentPosition;
- token = TokenNameRestrictedIdentifierYield;
+private boolean disambiguateYieldWithLookAhead() {
+ getVanguardParser();
+ this.vanguardScanner.resetTo(this.currentPosition, this.eofPosition - 1);
+ try {
+ int lookAhead1 = this.vanguardScanner.getNextToken();
+ switch (lookAhead1) {
+ case TokenNameEQUAL_EQUAL :
+ case TokenNameLESS_EQUAL :
+ case TokenNameGREATER_EQUAL :
+ case TokenNameNOT_EQUAL :
+ case TokenNameLEFT_SHIFT :
+ case TokenNameRIGHT_SHIFT :
+ case TokenNameUNSIGNED_RIGHT_SHIFT :
+ case TokenNamePLUS_EQUAL :
+ case TokenNameMINUS_EQUAL :
+ case TokenNameMULTIPLY_EQUAL :
+ case TokenNameDIVIDE_EQUAL :
+ case TokenNameAND_EQUAL :
+ case TokenNameOR_EQUAL :
+ case TokenNameXOR_EQUAL :
+ case TokenNameREMAINDER_EQUAL :
+ case TokenNameLEFT_SHIFT_EQUAL :
+ case TokenNameRIGHT_SHIFT_EQUAL :
+ case TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL :
+ case TokenNameOR_OR :
+ case TokenNameAND_AND :
+ case TokenNameREMAINDER :
+ case TokenNameXOR :
+ case TokenNameAND :
+ case TokenNameMULTIPLY :
+ case TokenNameOR :
+ case TokenNameTWIDDLE :
+ case TokenNameDIVIDE :
+ case TokenNameGREATER :
+ case TokenNameLESS :
+ case TokenNameLBRACE :
+ case TokenNameRBRACE :
+ case TokenNameLBRACKET :
+ case TokenNameRBRACKET :
+ case TokenNameSEMICOLON :
+ case TokenNameQUESTION :
+ case TokenNameCOLON :
+ case TokenNameCOMMA :
+ case TokenNameDOT :
+ case TokenNameEQUAL :
+ case TokenNameAT :
+ case TokenNameELLIPSIS :
+ case TokenNameARROW :
+ case TokenNameCOLON_COLON :
+ return false;
+ case TokenNameMINUS_MINUS :
+ case TokenNamePLUS_PLUS :
+ int lookAhead2 = this.vanguardScanner.getNextToken();
+ return lookAhead2 == TokenNameIdentifier;
+ default : return true;
+ }
+ } catch (InvalidInputException e) {
+ if (e.getMessage().equals(INVALID_CHAR_IN_STRING)) {
+ //Ignore
+ } else {
+ // Shouldn't happen, but log the error
+ e.printStackTrace();
}
}
- return token;
+ return false; // IIE event;
+}
+int disambiguatedRestrictedIdentifierYield(int restrictedIdentifierToken) {
+ // and here's the kludge
+ if (restrictedIdentifierToken != TokenNameRestrictedIdentifierYield)
+ return restrictedIdentifierToken;
+ if (this.sourceLevel < ClassFileConstants.JDK13 || !this.previewEnabled)
+ return TokenNameIdentifier;
+
+ return mayBeAtAnYieldStatement() && disambiguateYieldWithLookAhead() ?
+ restrictedIdentifierToken : TokenNameIdentifier;
}
int disambiguatedRestrictedKeyword(int restrictedKeywordToken) {
int token = restrictedKeywordToken;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
index 59f74b3..71f4de6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - extended API and implementation
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
index c8fbbc1..79ebe55 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -2633,4 +2629,9 @@
//
return this.parser.isParsingModuleDeclaration();
}
+
+ @Override
+ public boolean isParsingJava13() {
+ return this.parser.isParsingJava13();
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
index a8694df..4368620 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Benjamin Muskalla - Contribution for bug 239066
@@ -501,6 +497,7 @@
case IProblem.RedundantNullCheckAgainstNonNullType:
case IProblem.RedundantNullCheckOnField:
case IProblem.RedundantNullCheckOnConstNonNullField:
+ case IProblem.ConstNonNullFieldComparisonYieldsFalse:
case IProblem.FieldComparisonYieldsFalse:
return CompilerOptions.RedundantNullCheck;
@@ -836,6 +833,9 @@
return CompilerOptions.UnstableAutoModuleName;
case IProblem.PreviewFeatureUsed:
return CompilerOptions.PreviewFeatureUsed;
+
+ case IProblem.ProblemNotAnalysed:
+ return CompilerOptions.SuppressWarningsNotAnalysed;
}
return 0;
}
@@ -1836,13 +1836,12 @@
switch (problemID) {
case IProblem.VarargsConflict :
- return ProblemSeverities.Warning;
- case IProblem.TypeCollidesWithPackage :
- return ProblemSeverities.Warning;
case IProblem.SwitchExpressionsYieldUnqualifiedMethodWarning:
case IProblem.SwitchExpressionsYieldRestrictedGeneralWarning:
case IProblem.SwitchExpressionsYieldTypeDeclarationWarning:
return ProblemSeverities.Warning;
+ case IProblem.TypeCollidesWithPackage :
+ return ProblemSeverities.Error;
/*
* Javadoc tags resolved references errors
@@ -1929,8 +1928,6 @@
return ProblemSeverities.Warning;
case IProblem.IllegalUseOfUnderscoreAsAnIdentifier:
return this.underScoreIsError ? ProblemSeverities.Error : ProblemSeverities.Warning;
- case IProblem.ProblemNotAnalysed:
- return ProblemSeverities.Info; // Not configurable
}
int irritant = getIrritant(problemID);
if (irritant != 0) {
@@ -6680,7 +6677,7 @@
arguments = new String[] { new String(field.name),
new String(nonNullName[nonNullName.length-1]) };
} else if (field.constant() != Constant.NotAConstant) {
- problemId = IProblem.RedundantNullCheckOnConstNonNullField;
+ problemId = checkForNull ? IProblem.ConstNonNullFieldComparisonYieldsFalse : IProblem.RedundantNullCheckOnConstNonNullField;
char[][] nonNullName = this.options.nonNullAnnotationName;
arguments = new String[] { new String(field.name),
new String(nonNullName[nonNullName.length-1]) };
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
index bc305fb..b1fb8d0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties
@@ -818,7 +818,8 @@
941 = Redundant null check: The field {0} cannot be null at this location (ignoring concurrency)
942 = Null comparison always yields false: The field {0} cannot be null at this location (ignoring concurrency)
943 = Nullness default is redundant with a default specified for the enclosing module {0}
-944 = Null comparison always yields false: The field {0} is a nonnull constant
+944 = Redundant null check: The field {0} is a nonnull constant
+945 = Null comparison always yields false: The field {0} is a nonnull constant
951 = Potential null pointer access: array element may be null
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
index 596918f..2a4b7a9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -1302,7 +1302,7 @@
int count = 0;
int i = CharOperation.indexOf(C_PARAM_START, methodSignature);
if (i < 0) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
} else {
i++;
}
@@ -1312,14 +1312,14 @@
}
int e= Util.scanTypeSignature(methodSignature, i);
if (e < 0) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
} else {
i = e + 1;
}
count++;
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException(e);
+ throw new IllegalArgumentException(String.valueOf(methodSignature), e);
}
}
@@ -1342,7 +1342,7 @@
public static int scanTypeSignature(char[] string, int start) {
// need a minimum 1 char
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
switch (c) {
@@ -1380,7 +1380,7 @@
return end-1;
// SH}
default :
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
}
@@ -1404,13 +1404,13 @@
public static int scanBaseTypeSignature(char[] string, int start) {
// need a minimum 1 char
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if ("BCDFIJSVZ".indexOf(c) >= 0) { //$NON-NLS-1$
return start;
} else {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
}
@@ -1431,18 +1431,18 @@
int length = string.length;
// need a minimum 2 char
if (start >= length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_ARRAY) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[++start];
while(c == C_ARRAY) {
// need a minimum 2 char
if (start >= length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[++start];
}
@@ -1465,11 +1465,11 @@
public static int scanCaptureTypeSignature(char[] string, int start) {
// need a minimum 2 char
if (start >= string.length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_CAPTURE) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
return scanTypeBoundSignature(string, start + 1);
}
@@ -1490,19 +1490,19 @@
public static int scanTypeVariableSignature(char[] string, int start) {
// need a minimum 3 chars "Tx;"
if (start >= string.length - 2) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
// must start in "T"
char c = string[start];
if (c != C_TYPE_VARIABLE) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
int id = scanIdentifier(string, start + 1);
c = string[id + 1];
if (c == C_SEMICOLON) {
return id + 1;
} else {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
}
@@ -1519,7 +1519,7 @@
public static int scanIdentifier(char[] string, int start) {
// need a minimum 1 char
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
int p = start;
while (true) {
@@ -1555,7 +1555,7 @@
public static int scanClassTypeSignature(char[] string, int start) {
// need a minimum 3 chars "Lx;"
if (start >= string.length - 2) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
// must start in "L" or "Q"
char c = string[start];
@@ -1565,7 +1565,7 @@
int p = start + 1;
while (true) {
if (p >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[p];
if (c == C_SEMICOLON) {
@@ -1599,7 +1599,7 @@
public static int scanTypeBoundSignature(char[] string, int start) {
// need a minimum 1 char for wildcard
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
switch (c) {
@@ -1610,8 +1610,7 @@
break;
default :
// must start in "+/-"
- throw new IllegalArgumentException();
-
+ throw newIllegalArgumentException(string, start);
}
c = string[++start];
if (c != C_STAR && start >= string.length -1) { // unless "-*" we need at least one more char, e.g. after "+[", other variants are even longer
@@ -1633,7 +1632,7 @@
case C_STAR:
return start;
default:
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
}
@@ -1657,16 +1656,16 @@
public static int scanTypeArgumentSignatures(char[] string, int start) {
// need a minimum 2 char "<>"
if (start >= string.length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_GENERIC_START) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
int p = start + 1;
while (true) {
if (p >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[p];
if (c == C_GENERIC_END) {
@@ -1698,7 +1697,7 @@
public static int scanTypeArgumentSignature(char[] string, int start) {
// need a minimum 1 char
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
switch (c) {
@@ -1774,4 +1773,8 @@
}
}
}
+
+ private static IllegalArgumentException newIllegalArgumentException(char[] string, int start) {
+ return new IllegalArgumentException("\"" + String.valueOf(string) + "\" at " + start); //$NON-NLS-1$ //$NON-NLS-2$
+ }
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
index 2330cf3..22aee8f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -318,14 +314,14 @@
* up to and including Java SE 13 (aka JDK 13).
* </p>
*
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public static final int JLS13 = 13;
/**
* Internal synonym for {@link #JLS13}. Use to alleviate
* deprecation warnings once JLS13 is deprecated
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
static final int JLS13_INTERNAL = JLS13;
@@ -508,7 +504,7 @@
*
* @param options the table of options
* @see JavaCore#getDefaultOptions()
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public static AST newAST(Map<String, String> options) {
return new AST(options);
@@ -3009,7 +3005,7 @@
* label/identifier/expression and is not implicit.
*
* @return a new unparented yield statement node
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
* @noreference This method is not intended to be referenced by clients.
*/
public TextBlock newTextBlock() {
@@ -3321,7 +3317,7 @@
* label/identifier/expression and is not implicit.
*
* @return a new unparented yield statement node
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
* @noreference This method is not intended to be referenced by clients.
*/
public YieldStatement newYieldStatement() {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index 54f711e..9168fb6 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -3243,6 +3239,9 @@
}
public Expression convert(org.eclipse.jdt.internal.compiler.ast.TextBlock expression) {
+ if (!this.ast.isPreviewEnabled()) {
+ return createFakeNullLiteral(expression);
+ }
int length = expression.sourceEnd - expression.sourceStart + 1;
int sourceStart = expression.sourceStart;
TextBlock literal = new TextBlock(this.ast);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
index 21eb3ae..60f9265 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -2403,7 +2399,7 @@
* different node type or is <code>null</code>
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public boolean match(TextBlock node, Object other) {
if (!(other instanceof TextBlock)) {
@@ -2877,7 +2873,7 @@
* different node type or is <code>null</code>
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public boolean match(YieldStatement node, Object other) {
if (!(other instanceof YieldStatement)) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
index de137cc..74bb716 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java
@@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -972,112 +968,112 @@
* Node type constant indicating a node of type
* <code>YieldStatement</code>.
* @see YieldStatement
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
- public static final int YIELD_STATEMENT = 10;
+ public static final int YIELD_STATEMENT = 101;
/**
* Node type constant indicating a node of type
* <code>TextBlock</code>.
* @see TextBlock
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
- public static final int TEXT_BLOCK = 101;
+ public static final int TEXT_BLOCK = 102;
//{ObjectTeams: required OT specific node type constants added
-
+ private static final int LAST_JDT = 102;
/**
* Node type constant indicating a node of type
* <code>MethodSpec</code>.
* @see MethodSpec
*/
- public static final int METHOD_SPEC = 102;
+ public static final int METHOD_SPEC = LAST_JDT + 1;
/**
* Node type constant indicating a node of type
* <code>CallinMappingDeclaration</code>.
* @see CallinMappingDeclaration
*/
- public static final int CALLIN_MAPPING_DECLARATION = 103;
+ public static final int CALLIN_MAPPING_DECLARATION = LAST_JDT + 2;
/**
* Node type constant indicating a node of type
* <code>CalloutMappingDeclaration</code>.
* @see CalloutMappingDeclaration
*/
- public static final int CALLOUT_MAPPING_DECLARATION = 104;
+ public static final int CALLOUT_MAPPING_DECLARATION = LAST_JDT + 3;
/**
* Node type constant indicating a node of type
* <code>LiftingType</code>.
* @see LiftingType
*/
- public static final int LIFTING_TYPE = 105;
+ public static final int LIFTING_TYPE = LAST_JDT + 4;
/**
* Node type constant indicating a node of type
* <code>WithinStatement</code>.
* @see WithinStatement
*/
- public static final int WITHIN_STATEMENT = 106;
+ public static final int WITHIN_STATEMENT = LAST_JDT + 5;
/**
* Node type constant indicating a node of type
* <code>BaseConstructorMessageSend</code>.
* @see BaseConstructorInvocation
*/
- public static final int BASE_CONSTRUCTOR_INVOCATION = 107;
+ public static final int BASE_CONSTRUCTOR_INVOCATION = LAST_JDT + 6;
/**
* Node type constant indicating a node of type
* <code>ParameterMapping</code>.
* @see ParameterMapping
*/
- public static final int PARAMETER_MAPPING = 108;
+ public static final int PARAMETER_MAPPING = LAST_JDT + 7;
/**
* Node type constant indicating a node of type
* <code>BaseCallMessageSend</code>.
* @see BaseCallMessageSend
*/
- public static final int BASE_CALL_MESSAGE_SEND = 109;
+ public static final int BASE_CALL_MESSAGE_SEND = LAST_JDT + 8;
/**
* Node type constant indicating a node of type
* <code>FieldAccessSpec</code>.
* @see FieldAccessSpec
*/
- public static final int FIELD_ACCESS_SPEC = 110;
+ public static final int FIELD_ACCESS_SPEC = LAST_JDT + 9;
/**
* Node type constant indicating a node of type
* <code>RoleTypeDelaration</code>.
* @see RoleTypeDeclaration
*/
- public static final int ROLE_TYPE_DECLARATION = 111;
+ public static final int ROLE_TYPE_DECLARATION = LAST_JDT + 10;
/**
* Node type constant indicating a node of type
* <code>TSuperMessageSend</code>.
* @see TSuperMessageSend
*/
- public static final int TSUPER_MESSAGE_SEND = 112;
+ public static final int TSUPER_MESSAGE_SEND = LAST_JDT + 11;
/**
* Node type constant indicating a node of type
* <code>TSuperCallMessageSend</code>.
* @see TSuperMessageSend
*/
- public static final int TSUPER_CONSTRUCTOR_INVOCATION = 113;
+ public static final int TSUPER_CONSTRUCTOR_INVOCATION = LAST_JDT + 12;
- public static final int TYPE_ANCHOR = 114;
+ public static final int TYPE_ANCHOR = LAST_JDT + 13;
- public static final int PRECEDENCE_DECLARATION = 115;
+ public static final int PRECEDENCE_DECLARATION = LAST_JDT + 14;
- public static final int GUARD_PREDICATE_DECLARATION = 116;
+ public static final int GUARD_PREDICATE_DECLARATION = LAST_JDT + 15;
/** @since 1.3.1 */
- public static final int METHOD_BINDING_OPERATOR = 117;
+ public static final int METHOD_BINDING_OPERATOR = LAST_JDT + 16;
//gbr}
/**
@@ -1294,6 +1290,8 @@
return WhileStatement.class;
case WILDCARD_TYPE :
return WildcardType.class;
+ case YIELD_STATEMENT :
+ return YieldStatement.class;
//{ObjectTeams: entries for OT specific node types added
case METHOD_SPEC :
return MethodSpec.class;
@@ -2329,7 +2327,7 @@
* </p>
*
* @exception UnsupportedOperationException if this operation is is not used in JLS12
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
// In API Javadocs, add: * @deprecated In the JLS13 API, this method is replaced by {@link #replacement()}.
final void supportedOnlyIn12() {
@@ -2346,7 +2344,7 @@
* </p>
*
* @exception UnsupportedOperationException if this operation is not used in JLS13
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
final void supportedOnlyIn13() {
if (this.ast.apiLevel != AST.JLS13_INTERNAL) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
index 6711cde..af64584 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
index 6c5c7ac..f906311 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -1611,7 +1607,7 @@
* be skipped
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public boolean visit(TextBlock node) {
return true;
@@ -1893,7 +1889,7 @@
* be skipped
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public boolean visit(YieldStatement node) {
return true;
@@ -2936,7 +2932,7 @@
* @param node the node to visit
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public void endVisit(TextBlock node) {
// default implementation: do nothing
@@ -3433,7 +3429,7 @@
* @param node the node to visit
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @nooverride This method is not intended to be re-implemented or extended by clients as it is a part of Java preview feature.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public void endVisit(YieldStatement node) {
// default implementation: do nothing
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java
index 869f83f..25ca48c 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -100,7 +96,7 @@
* {@link StructuralPropertyDescriptor})
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
* @deprecated
- * @since 3.19
+ * @since 3.20
*/
public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
return PROPERTY_DESCRIPTORS;
@@ -135,11 +131,6 @@
}
@Override
- final List internalStructuralPropertiesForType(int apiLevel, boolean isPreviewEnabled) {
- return propertyDescriptors(apiLevel, isPreviewEnabled);
- }
-
- @Override
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {
if (property == LABEL_PROPERTY) {
if (get) {
@@ -172,9 +163,6 @@
result.setSourceRange(getStartPosition(), getLength());
result.copyLeadingComment(this);
result.setLabel((SimpleName) ASTNode.copySubtree(target, getLabel()));
- if (this.ast.apiLevel == AST.JLS12_INTERNAL) {
- result.setExpression((Expression) ASTNode.copySubtree(target, getExpression()));
- }
return result;
}
@@ -188,9 +176,6 @@
void accept0(ASTVisitor visitor) {
boolean visitChildren = visitor.visit(this);
if (visitChildren) {
- if (this.ast.apiLevel == AST.JLS12_INTERNAL) {
- acceptChild(visitor, getExpression());
- }
acceptChild(visitor, getLabel());
}
visitor.endVisit(this);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
index 0f3ac21..9ad64e2 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*Contributors:
* IBM Corporation - initial API and implementation
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
index c29c43f..fcd4047 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java
@@ -790,6 +790,7 @@
return this.getTypeBinding(compilerExpression.resolvedType);
}
break;
+ case ASTNode.TEXT_BLOCK :
case ASTNode.STRING_LITERAL :
if (this.scope != null) {
return this.getTypeBinding(this.scope.getJavaLangString());
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java
index 17135c6..7fc7125 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java
index dcfd886..a8ec301 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -94,7 +90,7 @@
* @return a list of property descriptors (element type:
* {@link StructuralPropertyDescriptor})
* @noreference This method is not intended to be referenced by clients.
- * @since 3.19
+ * @since 3.20
*/
public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
if (apiLevel == AST.JLS13_INTERNAL && previewEnabled) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java
index 93b984b..a74ed83 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java
@@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -31,7 +27,7 @@
*
* These are block of String literal nodes.
*
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
* @noinstantiate This class is not intended to be instantiated by clients.
* @noreference This class is not intended to be referenced by clients as it is a part of Java preview feature.
*/
@@ -84,7 +80,7 @@
* @return a list of property descriptors (element type:
* {@link StructuralPropertyDescriptor})
* @noreference This method is not intended to be referenced by clients.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
if (apiLevel == AST.JLS13_INTERNAL && previewEnabled) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/YieldStatement.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/YieldStatement.java
index 51af55a..4b1af17 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/YieldStatement.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/YieldStatement.java
@@ -7,10 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -29,7 +25,7 @@
* <b>Yield</b> <b>{ Identifier/Expression }</b>
* </pre>
*
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
* @noinstantiate This class is not intended to be instantiated by clients.
* @noreference This class is not intended to be referenced by clients as it is a part of Java preview feature.
*/
@@ -85,7 +81,7 @@
* @return a list of property descriptors (element type:
* {@link StructuralPropertyDescriptor})
* @noreference This method is not intended to be referenced by clients.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
*/
public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
if (apiLevel == AST.JLS13_INTERNAL && previewEnabled) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
index 3395136..a5d03d1 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - extended API and implementation
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
index 3e1805f..808894f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index bad8e1b..cd062a2 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
index f129aa7..8210f4f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
index 82d7b8e..c143a01 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
index 9b6e731..8fed55f 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
@@ -6,10 +6,6 @@
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- * SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Mateusz Matela <mateusz.matela@gmail.com> - [formatter] Formatter does not format Java code correctly, especially when max line width is set - https://bugs.eclipse.org/303519
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index 8fc546f..8709a5d 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -1677,6 +1677,28 @@
*/
public static final String COMPILER_PB_UNSTABLE_AUTO_MODULE_NAME = PLUGIN_ID + ".compiler.problem.unstableAutoModuleName"; //$NON-NLS-1$
+ /**
+ * Compiler option ID: Reporting when a {@code @SuppressWarnings} annotation might be unused, but exact information is not available.
+ * <p>
+ * This issue occurs when a suppress warnings token (like, e.g., {@code "unused"}) represents a group of problems,
+ * and some of the problems in that group are currently disabled (configured as "ignore").
+ * In this situation the compiler may not know if none of the problems in that group could be found within the
+ * annotated code section.
+ * <p>
+ * When enabled, the compiler will issue an error, warning or info when a {@code @SuppressWarnings} annotation
+ * was not observed to be necessary, but analysis of the suppressed group of problems was incomplete.
+ *
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed"</code></dd>
+ * <dt>Possible values:</dt>
+ * <dd><code>{ "error", "warning", "info", "ignore" }</code></dd>
+ * <dt>Default:</dt><dd><code>"info"</code></dd>
+ * </dl>
+ *
+ * @since 3.20
+ * @category CompilerOptionID
+ */
+ public static final String COMPILER_PB_SUPPRESS_WARNINGS_NOT_FULLY_ANALYSED = PLUGIN_ID + ".compiler.problem.suppressWarningsNotFullyAnalysed"; //$NON-NLS-1$
/**
* Compiler option ID: Annotation-based Null Analysis.
@@ -3082,7 +3104,7 @@
public static final String VERSION_12 = "12"; //$NON-NLS-1$
/**
* Configurable option value: {@value}.
- * @since 3.19 BETA_JAVA13
+ * @since 3.20
* @category OptionValue
*/
public static final String VERSION_13 = "13"; //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
index 4c6d2d1..5b92763 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java
@@ -544,11 +544,11 @@
int length = string.length;
// need a minimum 2 char
if (start >= length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_ARRAY) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
int index = start;
@@ -556,7 +556,7 @@
while(c == C_ARRAY) {
// need a minimum 2 char
if (index >= length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[++index];
}
@@ -590,11 +590,11 @@
private static int appendCaptureTypeSignature(char[] string, int start, boolean fullyQualifyTypeNames, StringBuffer buffer) {
// need a minimum 2 char
if (start >= string.length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_CAPTURE) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
buffer.append(CAPTURE).append(' ');
return appendTypeArgumentSignature(string, start + 1, fullyQualifyTypeNames, buffer);
@@ -616,12 +616,12 @@
private static int appendClassTypeSignature(char[] string, int start, boolean fullyQualifyTypeNames, StringBuffer buffer) {
// need a minimum 3 chars "Lx;"
if (start >= string.length - 2) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
// must start in "L" or "Q"
char c = string[start];
if (c != C_RESOLVED && c != C_UNRESOLVED) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
boolean resolved = (c == C_RESOLVED);
boolean removePackageQualifiers = !fullyQualifyTypeNames;
@@ -635,7 +635,7 @@
boolean inAnonymousType = false;
while (true) {
if (p >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[p];
switch(c) {
@@ -717,11 +717,11 @@
private static int appendIntersectionTypeSignature(char[] string, int start, boolean fullyQualifyTypeNames, StringBuffer buffer) {
// need a minimum 2 char
if (start >= string.length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_INTERSECTION) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
start = appendClassTypeSignature(string, start + 1, fullyQualifyTypeNames, buffer);
if (start < string.length - 1) {
@@ -814,7 +814,7 @@
private static int appendTypeArgumentSignature(char[] string, int start, boolean fullyQualifyTypeNames, StringBuffer buffer) {
// need a minimum 1 char
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
switch(c) {
@@ -850,18 +850,18 @@
private static int appendTypeArgumentSignatures(char[] string, int start, boolean fullyQualifyTypeNames, StringBuffer buffer) {
// need a minimum 2 char "<>"
if (start >= string.length - 1) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != C_GENERIC_START) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
buffer.append('<');
int p = start + 1;
int count = 0;
while (true) {
if (p >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
c = string[p];
if (c == C_GENERIC_END) {
@@ -914,7 +914,7 @@
private static int appendTypeSignature(char[] string, int start, boolean fullyQualifyTypeNames, StringBuffer buffer, boolean isVarArgs) {
// need a minimum 1 char
if (start >= string.length) {
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (isVarArgs) {
@@ -939,7 +939,7 @@
case C_CAPTURE:
case C_INTERSECTION :
default:
- throw new IllegalArgumentException(); // a var args is an array type
+ throw newIllegalArgumentException(string, start); // a var args is an array type
}
} else {
switch (c) {
@@ -1000,7 +1000,7 @@
return end-1;
// SH}
default :
- throw new IllegalArgumentException();
+ throw newIllegalArgumentException(string, start);
}
}
}
@@ -1053,7 +1053,7 @@
pos = consumeWhitespace(typeName, pos, length);
if (pos < length && typeName[pos] == expectedChar)
return pos + 1;
- if (!isOptional) throw new IllegalArgumentException(new String(typeName));
+ if (!isOptional) throw new IllegalArgumentException(String.valueOf(typeName));
return -1;
}
@@ -1101,7 +1101,8 @@
/**
* Creates a new type signature from the given type name encoded as a character
- * array. The type name may contain primitive types or array types or parameterized types.
+ * array. The type name may contain primitive types or array types or parameterized types
+ * or represent an intersection type in source code notation using {@code &}.
* This method is equivalent to
* <code>createTypeSignature(new String(typeName),isResolved).toCharArray()</code>,
* although more efficient for callers with character arrays rather than strings.
@@ -1120,11 +1121,11 @@
public static char[] createCharArrayTypeSignature(char[] typeName, boolean isResolved) {
if (typeName == null) throw new IllegalArgumentException("null"); //$NON-NLS-1$
int length = typeName.length;
- if (length == 0) throw new IllegalArgumentException(new String(typeName));
+ if (length == 0) throw new IllegalArgumentException(String.valueOf(typeName));
StringBuffer buffer = new StringBuffer(5);
int pos = encodeTypeSignature(typeName, 0, isResolved, length, buffer);
pos = consumeWhitespace(typeName, pos, length);
- if (pos < length) throw new IllegalArgumentException(new String(typeName));
+ if (pos < length) throw new IllegalArgumentException(String.valueOf(typeName));
char[] result = new char[length = buffer.length()];
buffer.getChars(0, length, result, 0);
return result;
@@ -1369,6 +1370,7 @@
case '>' :
case '[' :
case ',' :
+ case '&' :
break nameLoop;
case '.' :
buffer.append(C_DOT);
@@ -1399,14 +1401,14 @@
}
pos++;
}
- if (count == 0) throw new IllegalArgumentException(new String(typeName));
+ if (count == 0) throw new IllegalArgumentException(String.valueOf(typeName));
return pos;
}
private static int encodeTypeSignature(char[] typeName, int start, boolean isResolved, int length, StringBuffer buffer) {
int pos = start;
pos = consumeWhitespace(typeName, pos, length);
- if (pos >= length) throw new IllegalArgumentException(new String(typeName));
+ if (pos >= length) throw new IllegalArgumentException(String.valueOf(typeName));
int checkPos;
char currentChar = typeName[pos];
switch (currentChar) {
@@ -1522,35 +1524,49 @@
if (currentChar != '@')
// SH}
buffer.append(isResolved ? C_RESOLVED : C_UNRESOLVED);
- while (true) { // loop on qualifiedName[<args>][.qualifiedName[<args>]*
- pos = encodeQualifiedName(typeName, pos, length, buffer);
- checkPos = checkNextChar(typeName, '<', pos, length, true);
- if (checkPos > 0) {
- buffer.append(C_GENERIC_START);
- // Stop gap fix for <>.
- if ((pos = checkNextChar(typeName, '>', checkPos, length, true)) > 0) {
- buffer.append(C_GENERIC_END);
- } else {
- pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
- while ((checkPos = checkNextChar(typeName, ',', pos, length, true)) > 0) {
+ while (true) { // loop on type[&type]*
+ while (true) { // loop on qualifiedName[<args>][.qualifiedName[<args>]*
+ pos = encodeQualifiedName(typeName, pos, length, buffer);
+ checkPos = checkNextChar(typeName, '<', pos, length, true);
+ if (checkPos > 0) {
+ buffer.append(C_GENERIC_START);
+ // Stop gap fix for <>.
+ if ((pos = checkNextChar(typeName, '>', checkPos, length, true)) > 0) {
+ buffer.append(C_GENERIC_END);
+ } else {
pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ while ((checkPos = checkNextChar(typeName, ',', pos, length, true)) > 0) {
+ pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ }
+ pos = checkNextChar(typeName, '>', pos, length, false);
+ buffer.append(C_GENERIC_END);
}
- pos = checkNextChar(typeName, '>', pos, length, false);
- buffer.append(C_GENERIC_END);
+ }
+ checkPos = checkNextChar(typeName, '.', pos, length, true);
+ if (checkPos > 0) {
+ buffer.append(C_DOT);
+ pos = checkPos;
+ } else {
+ break;
}
}
- checkPos = checkNextChar(typeName, '.', pos, length, true);
+//{ObjectTeams: type anchor?
+ if (currentChar != '@')
+// SH}
+ buffer.append(C_NAME_END);
+ checkPos = checkNextChar(typeName, '&', pos, length, true);
if (checkPos > 0) {
- buffer.append(C_DOT);
- pos = checkPos;
+ if (buffer.charAt(0) != C_UNION) // the constant name is wrong, its value is correct :-X
+ buffer.insert(0, C_UNION);
+ buffer.append(C_COLON);
+ pos = encodeTypeSignature(typeName, checkPos, isResolved, length, buffer);
+ if (pos == length) {
+ break;
+ }
} else {
break;
}
}
-//{ObjectTeams: type anchor?
- if (currentChar != '@')
-// SH}
- buffer.append(C_NAME_END);
if (end > 0) pos = end; // skip array dimension which were preprocessed
return pos;
}
@@ -1573,7 +1589,7 @@
}
return count;
} catch (ArrayIndexOutOfBoundsException e) { // signature is syntactically incorrect if last character is C_ARRAY
- throw new IllegalArgumentException(e);
+ throw new IllegalArgumentException(String.valueOf(typeSignature));
}
}
@@ -1735,7 +1751,7 @@
int count = 0;
int i = CharOperation.indexOf(C_PARAM_START, methodSignature);
if (i < 0) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
} else {
i++;
}
@@ -1745,14 +1761,14 @@
}
int e= Util.scanTypeSignature(methodSignature, i);
if (e < 0) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
} else {
i = e + 1;
}
count++;
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException(e);
+ throw new IllegalArgumentException(String.valueOf(methodSignature), e);
}
}
@@ -1788,7 +1804,7 @@
}
int i = CharOperation.indexOf(C_PARAM_START, methodSignature);
if (i < 0) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
} else {
i++;
}
@@ -1799,14 +1815,14 @@
}
int e = Util.scanTypeSignature(methodSignature, i);
if (e < 0) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
result[t] = CharOperation.subarray(methodSignature, i, e + 1);
t++;
i = e + 1;
}
} catch (ArrayIndexOutOfBoundsException e) {
- throw new IllegalArgumentException(e);
+ throw new IllegalArgumentException(String.valueOf(methodSignature), e);
}
}
/**
@@ -1890,7 +1906,7 @@
// skip type parameters
int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
if (paren == -1) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
// there could be thrown exceptions behind, thus scan one type exactly
int last = Util.scanTypeSignature(methodSignature, paren+1);
@@ -2247,13 +2263,13 @@
if (exceptionStart == -1) {
int paren = CharOperation.lastIndexOf(C_PARAM_END, methodSignature);
if (paren == -1) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
// ignore return type
exceptionStart = Util.scanTypeSignature(methodSignature, paren+1) + 1;
int length = methodSignature.length;
if (exceptionStart == length) return CharOperation.NO_CHAR_CHAR;
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
int length = methodSignature.length;
int i = exceptionStart;
@@ -2263,7 +2279,7 @@
exceptionStart++;
i++;
} else {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
i = Util.scanTypeSignature(methodSignature, i) + 1;
exceptionList.add(CharOperation.subarray(methodSignature, exceptionStart,i));
@@ -2316,12 +2332,12 @@
}
}
if (start < 0) // invalid number of generic start/end
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(parameterizedTypeSignature));
ArrayList args = new ArrayList();
int p = start + 1;
while (true) {
if (p >= parameterizedTypeSignature.length) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(parameterizedTypeSignature));
}
char c = parameterizedTypeSignature[p];
if (c == C_GENERIC_END) {
@@ -2381,12 +2397,12 @@
break;
case C_GENERIC_END:
deep--;
- if (deep < 0) throw new IllegalArgumentException();
+ if (deep < 0) throw new IllegalArgumentException(String.valueOf(parameterizedTypeSignature));
if (deep == 0) start = idx+1;
break;
}
}
- if (deep > 0) throw new IllegalArgumentException();
+ if (deep > 0) throw new IllegalArgumentException(String.valueOf(parameterizedTypeSignature));
int size = pos+length-start;
char[] resized = new char[size];
System.arraycopy(result, 0, resized, 0, pos);
@@ -2425,7 +2441,7 @@
int p1 = CharOperation.indexOf(C_COLON, formalTypeParameterSignature);
if (p1 < 0) {
// no ":" means can't be a formal type parameter signature
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(formalTypeParameterSignature));
}
if (p1 == formalTypeParameterSignature.length - 1) {
// no class or interface bounds
@@ -2493,14 +2509,14 @@
while (i < length) {
if (methodOrTypeSignature[i] == C_GENERIC_END) {
int size = paramList.size();
- if (size == 0) throw new IllegalArgumentException();
+ if (size == 0) throw new IllegalArgumentException(String.valueOf(methodOrTypeSignature));
char[][] result;
paramList.toArray(result = new char[size][]);
return result;
}
i = CharOperation.indexOf(C_COLON, methodOrTypeSignature, i);
if (i < 0 || i >= length)
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodOrTypeSignature));
// iterate over bounds
while (methodOrTypeSignature[i] == ':') {
i++; // skip colon
@@ -2551,7 +2567,7 @@
} catch (ArrayIndexOutOfBoundsException e) {
// invalid signature, fall through
}
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodOrTypeSignature));
}
/**
* Extracts the type parameter signatures from the given method or type signature.
@@ -2637,7 +2653,7 @@
case C_UNION :
return UNION_TYPE_SIGNATURE;
default :
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(typeSignature));
}
}
@@ -2670,7 +2686,7 @@
int p = CharOperation.indexOf(C_COLON, formalTypeParameterSignature);
if (p < 0) {
// no ":" means can't be a formal type parameter signature
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(formalTypeParameterSignature));
}
return CharOperation.subarray(formalTypeParameterSignature, 0, p);
}
@@ -2840,7 +2856,7 @@
public static char[] toCharArray(char[] methodSignature, char[] methodName, char[][] parameterNames, boolean fullyQualifyTypeNames, boolean includeReturnType, boolean isVargArgs) {
int firstParen = CharOperation.indexOf(C_PARAM_START, methodSignature);
if (firstParen == -1) {
- throw new IllegalArgumentException();
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
StringBuffer buffer = new StringBuffer(methodSignature.length + 10);
@@ -3037,6 +3053,11 @@
}
return new String(toCharArray(methodSignature.toCharArray(), methodName == null ? null : methodName.toCharArray(), params, fullyQualifyTypeNames, includeReturnType, isVarArgs));
}
+
+private static IllegalArgumentException newIllegalArgumentException(char[] string, int start) {
+ return new IllegalArgumentException("\"" + String.valueOf(string) + "\" at " + start); //$NON-NLS-1$ //$NON-NLS-2$
+}
+
private Signature() {
// Not instantiable
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
index dca2bce..c0a44f1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java
index 2ab1d7f..960c190 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - extended API and implementation
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
index ec5c1b5..995579b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
index 5206fd6..a5a61f1 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java
index ffb0dc4..7880630 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -333,14 +333,14 @@
// root path
IPath path = entry.getPath();
if (ri.roots.get(path) == null) {
- ri.roots.put(path, new DeltaProcessor.RootInfo(project, path, ((ClasspathEntry)entry).fullInclusionPatternChars(), ((ClasspathEntry)entry).fullExclusionPatternChars(), entry.getEntryKind()));
+ ri.roots.put(path, new DeltaProcessor.RootInfo(project, path, ((ClasspathEntry)entry).fullInclusionPatternChars(), ((ClasspathEntry)entry).fullExclusionPatternChars(), entry));
} else {
List<RootInfo> rootList = ri.otherRoots.get(path);
if (rootList == null) {
rootList = new ArrayList<>();
ri.otherRoots.put(path, rootList);
}
- rootList.add(new DeltaProcessor.RootInfo(project, path, ((ClasspathEntry)entry).fullInclusionPatternChars(), ((ClasspathEntry)entry).fullExclusionPatternChars(), entry.getEntryKind()));
+ rootList.add(new DeltaProcessor.RootInfo(project, path, ((ClasspathEntry)entry).fullInclusionPatternChars(), ((ClasspathEntry)entry).fullExclusionPatternChars(), entry));
}
// source attachment path
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
index 0aa71be..784cee9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java
@@ -120,31 +120,34 @@
final public JavaProject project;
final IPath rootPath;
final int entryKind;
+ final IClasspathAttribute[] extraAttributes;
IPackageFragmentRoot root;
IPackageFragmentRoot cache;
- RootInfo(JavaProject project, IPath rootPath, char[][] inclusionPatterns, char[][] exclusionPatterns, int entryKind) {
+ RootInfo(JavaProject project, IPath rootPath, char[][] inclusionPatterns, char[][] exclusionPatterns, IClasspathEntry entry) {
this.project = project;
this.rootPath = rootPath;
this.inclusionPatterns = inclusionPatterns;
this.exclusionPatterns = exclusionPatterns;
- this.entryKind = entryKind;
+ this.entryKind = entry.getEntryKind();
+ this.extraAttributes = entry.getExtraAttributes();
this.cache = getPackageFragmentRoot();
}
public IPackageFragmentRoot getPackageFragmentRoot() {
IPackageFragmentRoot tRoot = null;
Object target = JavaModel.getTarget(this.rootPath, false/*don't check existence*/);
if (target instanceof IResource) {
- tRoot = this.project.getPackageFragmentRoot((IResource)target, this.rootPath);
+ tRoot = this.project.getPackageFragmentRoot((IResource)target, this.rootPath, this.extraAttributes);
} else {
- tRoot = this.project.getPackageFragmentRoot(this.rootPath.toOSString());
+ IPath canonicalizedPath = JavaProject.canonicalizedPath(new Path(this.rootPath.toOSString()));
+ tRoot = this.project.getPackageFragmentRoot0(canonicalizedPath, this.extraAttributes);
}
return tRoot;
}
public IPackageFragmentRoot getPackageFragmentRoot(IResource resource) {
if (this.root == null) {
if (resource != null) {
- this.root = this.project.getPackageFragmentRoot(resource);
+ this.root = this.project.getPackageFragmentRoot(resource, null/*no entry path*/, this.extraAttributes);
} else {
this.root = getPackageFragmentRoot();
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java
index e2ccdb1..e184a40 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java
@@ -146,12 +146,13 @@
if (externalPath == null || externalPath.isEmpty()) {
return false;
}
-
+
JavaModelManager manager = JavaModelManager.getJavaModelManager();
if (manager.isExternalFile(externalPath) || manager.isAssumedExternalFile(externalPath)) {
return false;
}
- if (!externalPath.isAbsolute() || (WINDOWS && externalPath.getDevice() == null)) {
+ if (!externalPath.isAbsolute()
+ || (WINDOWS && (externalPath.getDevice() == null && !externalPath.isUNC()))) {
// can be only project relative path
return false;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JModPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JModPackageFragmentRoot.java
index 70e2bd8..6370b87 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JModPackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JModPackageFragmentRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2017 IBM Corporation and others.
+ * Copyright (c) 2017, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,8 +13,8 @@
*******************************************************************************/
package org.eclipse.jdt.internal.core;
-import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.core.builder.ClasspathJMod;
import org.eclipse.jdt.internal.core.util.HashtableOfArrayToObject;
@@ -38,15 +38,8 @@
* based on a JMOD file that is not contained in a <code>IJavaProject</code> and
* does not have an associated <code>IResource</code>.
*/
- protected JModPackageFragmentRoot(IPath externalPath, JavaProject project) {
- super(externalPath, project);
- }
- /**
- * Constructs a package fragment root which is the root of the Java package directory hierarchy
- * based on a JMOD file.
- */
- protected JModPackageFragmentRoot(IResource resource, JavaProject project) {
- super(resource, project);
+ protected JModPackageFragmentRoot(IPath externalPath, JavaProject project, IClasspathAttribute[] extraAttributes) {
+ super(null, externalPath, project, extraAttributes);
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
index ff3fef2..16561c9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -16,6 +16,7 @@
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
@@ -29,6 +30,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IModuleDescription;
@@ -39,6 +41,7 @@
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
+import org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo;
import org.eclipse.jdt.internal.core.nd.IReader;
import org.eclipse.jdt.internal.core.nd.java.JavaIndex;
import org.eclipse.jdt.internal.core.nd.java.NdResourceFile;
@@ -74,21 +77,38 @@
private boolean multiVersion;
/**
- * Constructs a package fragment root which is the root of the Java package directory hierarchy
- * based on a JAR file that is not contained in a <code>IJavaProject</code> and
- * does not have an associated <code>IResource</code>.
+ * Reflects the extra attributes of the classpath entry declaring this root.
+ * Caution, this field is used in hashCode() & equals() to avoid overzealous sharing.
+ * Can be null, if lookup via the corresponding classpath entry failed.
*/
- protected JarPackageFragmentRoot(IPath externalJarPath, JavaProject project) {
- super(null, project);
- this.jarPath = externalJarPath;
- }
+ final protected IClasspathAttribute[] extraAttributes;
+
/**
* Constructs a package fragment root which is the root of the Java package directory hierarchy
* based on a JAR file.
*/
- protected JarPackageFragmentRoot(IResource resource, JavaProject project) {
+ public JarPackageFragmentRoot(IResource resource, IPath externalJarPath, JavaProject project, IClasspathAttribute[] attributes) {
super(resource, project);
- this.jarPath = resource.getFullPath();
+ this.jarPath = externalJarPath;
+ if (attributes == null) {
+ // attributes could either be
+ // (1) provided by the caller (particularly when creating from memento),
+ // (2) retrieved from the corresponding classpath entry (if a resolved classpath is available).
+ // These two cases should cover all normal scenarios, else extraAttributes will be null.
+ try {
+ PerProjectInfo perProjectInfo = project.getPerProjectInfo();
+ synchronized (perProjectInfo) {
+ if (perProjectInfo.resolvedClasspath != null && perProjectInfo.unresolvedEntryStatus == JavaModelStatus.VERIFIED_OK) {
+ IClasspathEntry classpathEntry = project.getClasspathEntryFor(externalJarPath);
+ if (classpathEntry != null)
+ attributes = classpathEntry.getExtraAttributes();
+ }
+ }
+ } catch (JavaModelException e) {
+ // ignore
+ }
+ }
+ this.extraAttributes = attributes;
}
/**
@@ -247,7 +267,8 @@
return true;
if (o instanceof JarPackageFragmentRoot) {
JarPackageFragmentRoot other= (JarPackageFragmentRoot) o;
- return this.jarPath.equals(other.jarPath);
+ return this.jarPath.equals(other.jarPath)
+ && Arrays.equals(this.extraAttributes, other.extraAttributes);
}
return false;
}
@@ -356,7 +377,7 @@
}
@Override
public int hashCode() {
- return this.jarPath.hashCode();
+ return this.jarPath.hashCode() + Arrays.hashCode(this.extraAttributes);
}
protected void initRawPackageInfo(HashtableOfArrayToObject rawPackageInfo, String entryName, boolean isDirectory, String compliance) {
int lastSeparator;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
index 9c49c54..9f1a666 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java
@@ -718,7 +718,7 @@
if (target instanceof IResource){
// internal target
- root = getPackageFragmentRoot((IResource) target, entryPath);
+ root = getPackageFragmentRoot((IResource) target, entryPath, resolvedEntry.getExtraAttributes());
} else if (target instanceof File) {
// external target
if (JavaModel.isFile(target)) {
@@ -747,10 +747,10 @@
}
accumulatedRoots.addAll(imageRoots);
} else if (JavaModel.isJmod((File) target)) {
- root = new JModPackageFragmentRoot(entryPath, this);
+ root = new JModPackageFragmentRoot(entryPath, this, resolvedEntry.getExtraAttributes());
}
else {
- root = new JarPackageFragmentRoot(entryPath, this);
+ root = new JarPackageFragmentRoot(null, entryPath, this, resolvedEntry.getExtraAttributes());
}
} else if (((File) target).isDirectory()) {
root = new ExternalPackageFragmentRoot(entryPath, this);
@@ -900,8 +900,8 @@
*/
class JImageModuleFragmentBridge extends JarPackageFragmentRoot {
- protected JImageModuleFragmentBridge(IPath externalJarPath) {
- super(externalJarPath, JavaProject.this);
+ protected JImageModuleFragmentBridge(IPath externalJarPath, IClasspathAttribute[] extraAttributes) {
+ super(null, externalJarPath, JavaProject.this, extraAttributes);
}
@Override
public PackageFragment getPackageFragment(String[] pkgName) {
@@ -911,7 +911,8 @@
public PackageFragment getPackageFragment(String[] pkgName, String mod) {
PackageFragmentRoot realRoot = new JrtPackageFragmentRoot(this.jarPath,
mod == null ? JRTUtil.JAVA_BASE : mod,
- JavaProject.this);
+ JavaProject.this,
+ this.extraAttributes);
return new JarPackageFragment(realRoot, pkgName);
}
@Override
@@ -941,7 +942,7 @@
@Override
public FileVisitResult visitModule(java.nio.file.Path path, String name) throws IOException {
- JrtPackageFragmentRoot root = new JrtPackageFragmentRoot(imagePath, name, JavaProject.this);
+ JrtPackageFragmentRoot root = new JrtPackageFragmentRoot(imagePath, name, JavaProject.this, resolvedEntry.getExtraAttributes());
roots.add(root);
if (rootToResolvedEntries != null)
rootToResolvedEntries.put(root, ((ClasspathEntry)resolvedEntry).combineWith((ClasspathEntry) referringEntry));
@@ -2028,6 +2029,7 @@
case JEM_PACKAGEFRAGMENTROOT:
String rootPath = IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH;
token = null;
+ List<IClasspathAttribute> attributes = new ArrayList<>();
while (memento.hasMoreTokens()) {
token = memento.nextToken();
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=331821
@@ -2042,12 +2044,23 @@
}
}
continue;
+ } else if (token == MementoTokenizer.CLASSPATH_ATTRIBUTE) {
+ // PFR memento is optionally trailed by all extra classpath attributes ("=/name=/value"):
+ String name = memento.nextToken();
+ String separator = memento.nextToken();
+ assert separator == MementoTokenizer.CLASSPATH_ATTRIBUTE;
+ String value = memento.nextToken();
+ attributes.add(new ClasspathAttribute(name, value));
+ continue;
}
rootPath += token;
}
+ IClasspathAttribute[] attributesArray = null;
+ if (!attributes.isEmpty())
+ attributesArray = attributes.toArray(new IClasspathAttribute[attributes.size()]);
JavaElement root = (mod == null) ?
- (JavaElement)getPackageFragmentRoot(new Path(rootPath)) :
- new JrtPackageFragmentRoot(new Path(rootPath), mod, this);
+ (JavaElement)getPackageFragmentRoot(new Path(rootPath), attributesArray) :
+ new JrtPackageFragmentRoot(new Path(rootPath), mod, this, attributesArray);
if (token != null && (token.charAt(0) == JEM_PACKAGEFRAGMENT)) {
return root.getHandleFromMemento(token, memento, owner);
} else {
@@ -2220,7 +2233,7 @@
* an absolute path that has less than 1 segment. The path may be relative or
* absolute.
*/
- public IPackageFragmentRoot getPackageFragmentRoot(IPath path) {
+ public IPackageFragmentRoot getPackageFragmentRoot(IPath path, IClasspathAttribute[] extraAttributes) {
if (!path.isAbsolute()) {
path = getPath().append(path);
}
@@ -2230,7 +2243,7 @@
}
if (path.getDevice() != null || JavaModel.getExternalTarget(path, true/*check existence*/) != null) {
// external path
- return getPackageFragmentRoot0(path);
+ return getPackageFragmentRoot0(path, extraAttributes);
}
IWorkspaceRoot workspaceRoot = this.project.getWorkspace().getRoot();
IResource resource = workspaceRoot.findMember(path);
@@ -2239,7 +2252,7 @@
if (path.getFileExtension() != null) {
if (!workspaceRoot.getProject(path.segment(0)).exists()) {
// assume it is an external ZIP archive
- return getPackageFragmentRoot0(path);
+ return getPackageFragmentRoot0(path, extraAttributes);
} else {
// assume it is an internal ZIP archive
resource = workspaceRoot.getFile(path);
@@ -2259,7 +2272,7 @@
resource = workspaceRoot.getFolder(path);
}
}
- return getPackageFragmentRoot(resource);
+ return getPackageFragmentRoot(resource, null, extraAttributes);
}
/**
@@ -2267,13 +2280,13 @@
*/
@Override
public IPackageFragmentRoot getPackageFragmentRoot(IResource resource) {
- return getPackageFragmentRoot(resource, null/*no entry path*/);
+ return getPackageFragmentRoot(resource, null/*no entry path*/, null/*no extra attributes*/);
}
- IPackageFragmentRoot getPackageFragmentRoot(IResource resource, IPath entryPath) {
+ public IPackageFragmentRoot getPackageFragmentRoot(IResource resource, IPath entryPath, IClasspathAttribute[] extraAttributes) {
switch (resource.getType()) {
case IResource.FILE:
- return new JarPackageFragmentRoot(resource, this);
+ return new JarPackageFragmentRoot(resource, resource.getFullPath(), this, extraAttributes);
case IResource.FOLDER:
if (ExternalFoldersManager.isInternalPathForExternalFolder(resource.getFullPath()))
return new ExternalPackageFragmentRoot(resource, entryPath, this);
@@ -2290,26 +2303,26 @@
*/
@Override
public IPackageFragmentRoot getPackageFragmentRoot(String externalLibraryPath) {
- return getPackageFragmentRoot0(JavaProject.canonicalizedPath(new Path(externalLibraryPath)));
+ return getPackageFragmentRoot0(JavaProject.canonicalizedPath(new Path(externalLibraryPath)), null);
}
/*
* no path canonicalization
*/
- public IPackageFragmentRoot getPackageFragmentRoot0(IPath externalLibraryPath) {
+ public IPackageFragmentRoot getPackageFragmentRoot0(IPath externalLibraryPath, IClasspathAttribute[] extraAttributes) {
IFolder linkedFolder = JavaModelManager.getExternalManager().getFolder(externalLibraryPath);
if (linkedFolder != null)
return new ExternalPackageFragmentRoot(linkedFolder, externalLibraryPath, this);
if (JavaModelManager.isJrt(externalLibraryPath)) {
- return this.new JImageModuleFragmentBridge(externalLibraryPath);
+ return this.new JImageModuleFragmentBridge(externalLibraryPath, extraAttributes);
}
Object target = JavaModel.getTarget(externalLibraryPath, true/*check existency*/);
if (target instanceof File && JavaModel.isFile(target)) {
if (JavaModel.isJmod((File) target)) {
- return new JModPackageFragmentRoot(externalLibraryPath, this);
+ return new JModPackageFragmentRoot(externalLibraryPath, this, extraAttributes);
}
}
- return new JarPackageFragmentRoot(externalLibraryPath, this);
+ return new JarPackageFragmentRoot(null, externalLibraryPath, this, extraAttributes);
}
/**
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java
index dba3e1a..201ffe8 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015, 2018 IBM Corporation and others.
+ * Copyright (c) 2015, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -18,9 +18,12 @@
import java.nio.file.Path;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
+import java.util.Arrays;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IClasspathAttribute;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaModelStatusConstants;
import org.eclipse.jdt.core.IModuleDescription;
@@ -49,8 +52,8 @@
* Constructs a package fragment root which represents a module
* contained in a JRT.
*/
- protected JrtPackageFragmentRoot(IPath jrtPath, String moduleName, JavaProject project) {
- super(jrtPath, project);
+ protected JrtPackageFragmentRoot(IPath jrtPath, String moduleName, JavaProject project, IClasspathAttribute[] extraAttributes) {
+ super(null, jrtPath, project, extraAttributes);
this.moduleName = moduleName;
}
@@ -113,7 +116,8 @@
if (o instanceof JrtPackageFragmentRoot) {
JrtPackageFragmentRoot other= (JrtPackageFragmentRoot) o;
return this.moduleName.equals(other.moduleName) &&
- this.jarPath.equals(other.jarPath);
+ this.jarPath.equals(other.jarPath) &&
+ Arrays.equals(this.extraAttributes, other.extraAttributes);
}
return false;
}
@@ -128,7 +132,7 @@
}
@Override
public int hashCode() {
- return this.jarPath.hashCode() + this.moduleName.hashCode();
+ return this.jarPath.hashCode() + this.moduleName.hashCode() + Arrays.hashCode(this.extraAttributes);
}
@Override
protected void toStringInfo(int tab, StringBuffer buffer, Object info, boolean showResolvedInfo) {
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 5d8f782..1d8f9c8 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
@@ -507,6 +507,19 @@
buff.append(JavaElement.JEM_MODULE);
escapeMementoName(buff, getElementName());
}
+ try {
+ IClasspathEntry entry = getJavaProject().getClasspathEntryFor(getPath());
+ if (entry != null) {
+ for (IClasspathAttribute attribute : entry.getExtraAttributes()) {
+ appendEscapedDelimiter(buff, JavaElement.JEM_PACKAGEFRAGMENTROOT);
+ escapeMementoName(buff, attribute.getName());
+ appendEscapedDelimiter(buff, JavaElement.JEM_PACKAGEFRAGMENTROOT);
+ escapeMementoName(buff, attribute.getValue());
+ }
+ }
+ } catch (JavaModelException e) {
+ // ignore
+ }
}
/**
* @see IPackageFragmentRoot
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
index d507ed1..5a3dc95 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java
@@ -51,10 +51,13 @@
public class ClasspathJrtWithReleaseOption extends ClasspathJrt {
+ static String MODULE_INFO = "module-info.sig"; //$NON-NLS-1$
+
final String release;
String releaseInHex;
private String[] subReleases;
private java.nio.file.FileSystem fs;
+ protected Path releasePath;
protected Path modulePath;
private String modPathString;
private boolean isJRE12Plus;
@@ -134,15 +137,15 @@
return;
}
}
- Path releasePath = this.fs.getPath("/"); //$NON-NLS-1$
- this.isJRE12Plus = isJRE12Plus(releasePath);
+ this.releasePath = this.fs.getPath("/"); //$NON-NLS-1$
+ this.isJRE12Plus = isJRE12Plus(this.releasePath);
Path modPath = this.fs.getPath(this.releaseInHex + (this.isJRE12Plus ? "" : "-modules")); //$NON-NLS-1$ //$NON-NLS-2$
if (Files.exists(modPath)) {
this.modulePath = modPath;
this.modPathString = this.zipFilename + "|"+ modPath.toString(); //$NON-NLS-1$
}
- if (!Files.exists(releasePath.resolve(this.releaseInHex))) {
+ if (!Files.exists(this.releasePath.resolve(this.releaseInHex))) {
Exception e = new IllegalArgumentException("release " + this.release + " is not found in the system"); //$NON-NLS-1$//$NON-NLS-2$
throw new CoreException(new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, e.getMessage(), e));
}
@@ -152,7 +155,7 @@
}
if (this.release != null) {
List<String> sub = new ArrayList<>();
- try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(releasePath)) {
+ try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(this.releasePath)) {
for (final java.nio.file.Path subdir : stream) {
String rel = JRTUtil.sanitizedFileName(subdir);
if (rel.contains(this.releaseInHex)) {
@@ -226,10 +229,12 @@
return;
Set<IModule> cache = ModulesCache.get(jrt.modPathString);
if (cache == null) {
- try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(jrt.modulePath)) {
+ try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(jrt.releasePath)) {
for (final java.nio.file.Path subdir : stream) {
-
- Files.walkFileTree(subdir, Collections.EMPTY_SET, 1, new FileVisitor<java.nio.file.Path>() {
+ if (!subdir.getFileName().toString().contains(jrt.releaseInHex)) {
+ continue;
+ }
+ Files.walkFileTree(subdir, Collections.EMPTY_SET, 2, new FileVisitor<java.nio.file.Path>() {
@Override
public FileVisitResult preVisitDirectory(java.nio.file.Path dir, BasicFileAttributes attrs)
throws IOException {
@@ -239,14 +244,16 @@
@Override
public FileVisitResult visitFile(java.nio.file.Path f, BasicFileAttributes attrs)
throws IOException {
- byte[] content = null;
- if (Files.exists(f)) {
- content = JRTUtil.safeReadBytes(f);
+ if (attrs.isDirectory() || f.getNameCount() < 3) {
+ return FileVisitResult.CONTINUE;
+ }
+ if (f.getFileName().toString().equals(MODULE_INFO)) {
+ byte[] content = JRTUtil.safeReadBytes(f);
if (content == null)
return FileVisitResult.CONTINUE;
jrt.acceptModule(content);
}
- return FileVisitResult.CONTINUE;
+ return FileVisitResult.SKIP_SIBLINGS;
}
@Override
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java
index bb0ec38..d00f905 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java
@@ -8,10 +8,6 @@
*
* SPDX-License-Identifier: EPL-2.0
*
- * This is an implementation of an early-draft specification developed under the Java
- * Community Process (JCP) and is made available for testing and evaluation purposes
- * only. The code is not compatible with any specification of the JCP.
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java
index 59db454..51cfb8e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java
@@ -366,10 +366,10 @@
if (classpathEnty != null) {
if (target instanceof IFile) {
// internal jar
- return (PackageFragmentRoot) javaProject.getPackageFragmentRoot((IFile)target);
+ return (PackageFragmentRoot) javaProject.getPackageFragmentRoot((IFile)target, null, classpathEnty.getExtraAttributes());
} else {
// external jar
- return (PackageFragmentRoot) javaProject.getPackageFragmentRoot0(jarPath);
+ return (PackageFragmentRoot) javaProject.getPackageFragmentRoot0(jarPath, classpathEnty.getExtraAttributes());
}
}
} catch (JavaModelException e) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java
index 5e5c86d..b610afd 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2018 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -38,6 +38,7 @@
public static final String LAMBDA_EXPRESSION = Character.toString(JavaElement.JEM_LAMBDA_EXPRESSION);
public static final String LAMBDA_METHOD = Character.toString(JavaElement.JEM_LAMBDA_METHOD);
public static final String STRING = Character.toString(JavaElement.JEM_STRING);
+ public static final String CLASSPATH_ATTRIBUTE = JAVAPROJECT+PACKAGEFRAGMENTROOT;
private final char[] memento;
private final int length;
@@ -77,6 +78,8 @@
return LAMBDA_METHOD;
case JavaElement.JEM_STRING:
return STRING;
+ case JavaElement.JEM_PACKAGEFRAGMENTROOT:
+ return CLASSPATH_ATTRIBUTE;
default:
this.index--;
break;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
index 52401cb..116b61c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others.
+ * Copyright (c) 2000, 2019 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -2572,11 +2572,11 @@
int length = string.length;
// need a minimum 2 char
if (start >= length - 1) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != Signature.C_ARRAY) {
- throw raiseUnexpectedCharacterException(string, start, c);
+ throw newUnexpectedCharacterException(string, start, c);
}
int index = start;
@@ -2584,7 +2584,7 @@
while(c == Signature.C_ARRAY) {
// need a minimum 2 char
if (index >= length - 1) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
c = string[++index];
}
@@ -3080,7 +3080,7 @@
public static char[] toAnchor(int startingIndex, char[] methodSignature, char[] methodName, boolean isVargArgs) {
int firstParen = CharOperation.indexOf(Signature.C_PARAM_START, methodSignature);
if (firstParen == -1) {
- throw new IllegalArgumentException(new String(methodSignature));
+ throw new IllegalArgumentException(String.valueOf(methodSignature));
}
StringBuffer buffer = new StringBuffer(methodSignature.length + 10);
@@ -3113,7 +3113,7 @@
private static int appendTypeSignatureForAnchor(char[] string, int start, StringBuffer buffer, boolean isVarArgs) {
// need a minimum 1 char
if (start >= string.length) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (isVarArgs) {
@@ -3137,7 +3137,7 @@
case Signature.C_CAPTURE:
default:
// a var args is an array type
- throw raiseUnexpectedCharacterException(string, start, c);
+ throw newUnexpectedCharacterException(string, start, c);
}
} else {
switch (c) {
@@ -3183,7 +3183,7 @@
case Signature.C_SUPER:
return appendTypeArgumentSignatureForAnchor(string, start, buffer);
default :
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
}
}
@@ -3191,7 +3191,7 @@
private static int appendTypeArgumentSignatureForAnchor(char[] string, int start, StringBuffer buffer) {
// need a minimum 1 char
if (start >= string.length) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
switch(c) {
@@ -3208,11 +3208,11 @@
private static int appendCaptureTypeSignatureForAnchor(char[] string, int start, StringBuffer buffer) {
// need a minimum 2 char
if (start >= string.length - 1) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != Signature.C_CAPTURE) {
- throw raiseUnexpectedCharacterException(string, start, c);
+ throw newUnexpectedCharacterException(string, start, c);
}
return appendTypeArgumentSignatureForAnchor(string, start + 1, buffer);
}
@@ -3220,11 +3220,11 @@
int length = string.length;
// need a minimum 2 char
if (start >= length - 1) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
char c = string[start];
if (c != Signature.C_ARRAY) {
- throw raiseUnexpectedCharacterException(string, start, c);
+ throw newUnexpectedCharacterException(string, start, c);
}
int index = start;
@@ -3232,7 +3232,7 @@
while(c == Signature.C_ARRAY) {
// need a minimum 2 char
if (index >= length - 1) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
c = string[++index];
}
@@ -3253,17 +3253,17 @@
private static int appendClassTypeSignatureForAnchor(char[] string, int start, StringBuffer buffer) {
// need a minimum 3 chars "Lx;"
if (start >= string.length - 2) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
// must start in "L" or "Q"
char c = string[start];
if (c != Signature.C_RESOLVED && c != Signature.C_UNRESOLVED) {
- throw raiseUnexpectedCharacterException(string, start, c);
+ throw newUnexpectedCharacterException(string, start, c);
}
int p = start + 1;
while (true) {
if (p >= string.length) {
- throw raiseIllegalSignatureException(string, start);
+ throw newIllegalArgumentException(string, start);
}
c = string[p];
switch(c) {
@@ -3298,12 +3298,12 @@
}
}
- private static IllegalArgumentException raiseIllegalSignatureException(char[] string, int start) {
- throw new IllegalArgumentException("\"" + new String(string) + "\" starting at " + start); //$NON-NLS-1$ //$NON-NLS-2$
+ private static IllegalArgumentException newIllegalArgumentException(char[] string, int index) {
+ return new IllegalArgumentException("\"" + String.valueOf(string) + "\" at " + index); //$NON-NLS-1$ //$NON-NLS-2$
}
- private static IllegalArgumentException raiseUnexpectedCharacterException(char[] string, int start, char unexpected) {
- throw new IllegalArgumentException("Unexpected '" + unexpected + "' in \"" + new String(string) + "\" starting at " + start); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ private static IllegalArgumentException newUnexpectedCharacterException(char[] string, int start, char unexpected) {
+ return new IllegalArgumentException("Unexpected '" + unexpected + "' in \"" + String.valueOf(string) + "\" starting at " + start); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
private static int scanGenericEnd(char[] string, int start) {
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index 5a2bba3..c2ce2e6 100644
--- a/org.eclipse.jdt.core/pom.xml
+++ b/org.eclipse.jdt.core/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>eclipse.jdt.core</groupId>
- <version>4.13.0-SNAPSHOT</version>
+ <version>4.14.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
- <version>3.19.50-SNAPSHOT</version>
+ <version>3.20.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF
index 0338dc7..70d4152 100644
--- a/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF
@@ -13,7 +13,7 @@
org.eclipse.objectteams.otdt.internal.core.ext;x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.8.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.19.0.OTDT_r275,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.19.0.OTDT_r276,4.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.6.100,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.7.100,4.0.0)",
org.eclipse.osgi;bundle-version="[3.10.0,4.0.0)",
diff --git a/releng/map/otdt.map.in b/releng/map/otdt.map.in
index 5140485..2219919 100644
--- a/releng/map/otdt.map.in
+++ b/releng/map/otdt.map.in
@@ -9,7 +9,7 @@
feature@org.eclipse.objectteams.otequinox.turbo=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=features/org.eclipse.objectteams.otequinox.turbo.feature,tag=builds/201506091717
!-- Also don't use version numbers for those plugins that hold the various otre jars: --
-plugin@org.eclipse.jdt.core,3.19.0.OTDT_r275_qualifier=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=org.eclipse.jdt.core
+plugin@org.eclipse.jdt.core,3.19.0.OTDT_r276_qualifier=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=org.eclipse.jdt.core
!next plug-in don't specify version so that org.eclipse.objectteams.runtime/customBuildCallbacks.xml will find the plug-in directory:
plugin@org.eclipse.objectteams.otdt=GIT,repo=git://git.eclipse.org/gitroot/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt