update jdt.core from origin BETA_JAVA8 with
36e62a22bf3ca5d36bead22f45472e31ca662132 upto
83b2f6a03c3dc62e9f0da4478de073882f53022b
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 501de20..fc088ce 100644
--- a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -19,8 +19,8 @@
org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)",
- org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)",
- org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)",
+ org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional,
+ org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional,
org.eclipse.objectteams.otdt
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Eclipse-BundleShape: dir
diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml
index 9b3bc2f..391478e 100644
--- a/org.eclipse.jdt.core.tests.compiler/pom.xml
+++ b/org.eclipse.jdt.core.tests.compiler/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>eclipse.jdt.core</groupId>
- <version>4.4.0-SNAPSHOT</version>
+ <version>4.3.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.compiler</artifactId>
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 5b13a5b..9fb25bd 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
@@ -33,6 +33,8 @@
* bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
* Jesper S Moller - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
@@ -427,6 +429,7 @@
expectedProblemAttributes.put("CodeSnippetMissingClass", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("CodeSnippetMissingMethod", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("ContradictoryNullAnnotations", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
+ expectedProblemAttributes.put("ContradictoryNullAnnotationsOnBound", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("ComparingIdentical", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("ConflictingImport", new ProblemAttributes(CategorizedProblem.CAT_IMPORT));
expectedProblemAttributes.put("ConflictingNullAnnotations", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
@@ -824,13 +827,16 @@
expectedProblemAttributes.put("NotVisibleType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("NullableFieldReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullAnnotationUnsupportedLocation", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
+ expectedProblemAttributes.put("NullAnnotationUnsupportedLocationAtType", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("NullExpressionReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullLocalVariableComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullLocalVariableReference", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullityMismatchingTypeAnnotation", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
+ expectedProblemAttributes.put("NullityMismatchingTypeAnnotationSuperHint", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullityMismatchTypeArgument", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullityUncheckedTypeAnnotationDetail", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
+ expectedProblemAttributes.put("NullityUncheckedTypeAnnotationDetailSuperHint", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NullSourceString", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
expectedProblemAttributes.put("NullUnboxing", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NumericValueOutOfRange", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
@@ -1004,6 +1010,7 @@
expectedProblemAttributes.put("UnsafeElementTypeConversion", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
expectedProblemAttributes.put("UnsafeGenericArrayForVarargs", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
expectedProblemAttributes.put("UnsafeGenericCast", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
+ expectedProblemAttributes.put("UnsafeNullnessCast", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("UnsafeRawConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
expectedProblemAttributes.put("UnsafeRawFieldAssignment", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
expectedProblemAttributes.put("UnsafeRawGenericConstructorInvocation", new ProblemAttributes(CategorizedProblem.CAT_UNCHECKED_RAW));
@@ -1308,6 +1315,7 @@
expectedProblemAttributes.put("ConflictingInheritedNullAnnotations", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
expectedProblemAttributes.put("ConstructorReferenceNotBelow18", SKIP);
expectedProblemAttributes.put("ContradictoryNullAnnotations", SKIP);
+ expectedProblemAttributes.put("ContradictoryNullAnnotationsOnBound", SKIP);
expectedProblemAttributes.put("ConstructorVarargsArgumentNeedCast", new ProblemAttributes(JavaCore.COMPILER_PB_VARARGS_ARGUMENT_NEED_CAST));
expectedProblemAttributes.put("CorruptedSignature", SKIP);
expectedProblemAttributes.put("DanglingReference", SKIP);
@@ -1697,9 +1705,12 @@
expectedProblemAttributes.put("NotVisibleType", SKIP);
expectedProblemAttributes.put("NullableFieldReference", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_REFERENCE));
expectedProblemAttributes.put("NullAnnotationUnsupportedLocation", SKIP);
+ expectedProblemAttributes.put("NullAnnotationUnsupportedLocationAtType", SKIP);
expectedProblemAttributes.put("NullityMismatchingTypeAnnotation", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
+ expectedProblemAttributes.put("NullityMismatchingTypeAnnotationSuperHint", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
expectedProblemAttributes.put("NullityMismatchTypeArgument", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_SPECIFICATION_VIOLATION));
expectedProblemAttributes.put("NullityUncheckedTypeAnnotationDetail", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
+ expectedProblemAttributes.put("NullityUncheckedTypeAnnotationDetailSuperHint", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
expectedProblemAttributes.put("NullExpressionReference", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_REFERENCE));
expectedProblemAttributes.put("NullLocalVariableComparisonYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
expectedProblemAttributes.put("NullLocalVariableInstanceofYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
@@ -1877,6 +1888,7 @@
expectedProblemAttributes.put("UnsafeElementTypeConversion", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
expectedProblemAttributes.put("UnsafeGenericArrayForVarargs", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
expectedProblemAttributes.put("UnsafeGenericCast", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
+ expectedProblemAttributes.put("UnsafeNullnessCast", new ProblemAttributes(JavaCore.COMPILER_PB_NULL_UNCHECKED_CONVERSION));
expectedProblemAttributes.put("UnsafeRawConstructorInvocation", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
expectedProblemAttributes.put("UnsafeRawFieldAssignment", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
expectedProblemAttributes.put("UnsafeRawGenericConstructorInvocation", new ProblemAttributes(JavaCore.COMPILER_PB_UNCHECKED_TYPE_OPERATION));
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java
index e2369c8..9d9aecb 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java
@@ -1557,80 +1557,60 @@
"----------\n" +
"5. ERROR in X.java (at line 4)\n" +
" Object q = (@Marker java. @Marker util. @Marker List<@Marker String> []) null;\n" +
- " ^^^^^^\n" +
- "Marker cannot be resolved to a type\n" +
- "----------\n" +
- "6. ERROR in X.java (at line 4)\n" +
- " Object q = (@Marker java. @Marker util. @Marker List<@Marker String> []) null;\n" +
" ^^^^^^^\n" +
"Syntax error, type annotations are illegal here\n" +
"----------\n" +
- "7. ERROR in X.java (at line 4)\n" +
- " Object q = (@Marker java. @Marker util. @Marker List<@Marker String> []) null;\n" +
- " ^^^^^^\n" +
- "Marker cannot be resolved to a type\n" +
- "----------\n" +
- "8. ERROR in X.java (at line 4)\n" +
+ "6. ERROR in X.java (at line 4)\n" +
" Object q = (@Marker java. @Marker util. @Marker List<@Marker String> []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
"----------\n" +
- "9. ERROR in X.java (at line 4)\n" +
+ "7. ERROR in X.java (at line 4)\n" +
" Object q = (@Marker java. @Marker util. @Marker List<@Marker String> []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
"----------\n" +
- "10. ERROR in X.java (at line 5)\n" +
+ "8. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^^\n" +
"Syntax error, type annotations are illegal here\n" +
"----------\n" +
- "11. ERROR in X.java (at line 5)\n" +
+ "9. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"The member type Map<String,String>.Entry cannot be qualified with a parameterized type, since it is static. Remove arguments from qualifying type Map<String,String>\n" +
"----------\n" +
- "12. ERROR in X.java (at line 5)\n" +
- " Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
- " ^^^^^^\n" +
- "Marker cannot be resolved to a type\n" +
- "----------\n" +
- "13. ERROR in X.java (at line 5)\n" +
+ "10. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^^\n" +
"Syntax error, type annotations are illegal here\n" +
"----------\n" +
- "14. ERROR in X.java (at line 5)\n" +
- " Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
- " ^^^^^^\n" +
- "Marker cannot be resolved to a type\n" +
- "----------\n" +
- "15. ERROR in X.java (at line 5)\n" +
+ "11. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^^\n" +
"Type annotations are not allowed on type names used to access static members\n" +
"----------\n" +
- "16. ERROR in X.java (at line 5)\n" +
+ "12. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
"----------\n" +
- "17. ERROR in X.java (at line 5)\n" +
+ "13. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
"----------\n" +
- "18. ERROR in X.java (at line 5)\n" +
+ "14. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
"----------\n" +
- "19. ERROR in X.java (at line 5)\n" +
+ "15. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
"----------\n" +
- "20. ERROR in X.java (at line 5)\n" +
+ "16. ERROR in X.java (at line 5)\n" +
" Object r = (@Marker java. @Marker util.@Marker Map<@Marker String, @Marker String>.@Marker Entry @Marker []) null;\n" +
" ^^^^^^\n" +
"Marker cannot be resolved to a type\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JSR308SpecSnippetTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JSR308SpecSnippetTests.java
index c8ae17c..2582042 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JSR308SpecSnippetTests.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JSR308SpecSnippetTests.java
@@ -18,6 +18,8 @@
* Bug 415399 - [1.8][compiler] Type annotations on constructor results dropped by the code generator
* Bug 415470 - [1.8][compiler] Type annotations on class declaration go vanishing
* Bug 414384 - [1.8] type annotation on abbreviated inner class is not marked as inner type
+ * Jesper S Moller - Contributions for
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
@@ -428,16 +430,16 @@
"");
String expectedOutput =
" RuntimeInvisibleTypeAnnotations: \n" +
- " #35 @Vernal(\n" +
+ " #36 @Vernal(\n" +
" target type = 0x46 METHOD_REFERENCE\n" +
" offset = 0\n" +
" )\n" +
- " #36 @English(\n" +
+ " #37 @English(\n" +
" target type = 0x46 METHOD_REFERENCE\n" +
" offset = 6\n" +
" location = [TYPE_ARGUMENT(0)]\n" +
" )\n" +
- " #37 @NonNegative(\n" +
+ " #38 @NonNegative(\n" +
" target type = 0x4b METHOD_REFERENCE_TYPE_ARGUMENT\n" +
" offset = 12\n" +
" type argument index = 0\n" +
@@ -2470,4 +2472,449 @@
"}";
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "pkg" + File.separator + "Clazz.class", "pkg.Clazz", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
}
+ // More type path tests
+ public void test044() throws Exception {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface I {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface F {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface G {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface H {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "class X {\n" +
+ " @I String @F [] @G [] @H [] f;\n" +
+ "}\n",
+ },
+ "");
+
+ String expectedOutput =
+ " // Field descriptor #6 [[[Ljava/lang/String;\n" +
+ " java.lang.String[][][] f;\n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #8 @I(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [ARRAY, ARRAY, ARRAY]\n" +
+ " )\n" +
+ " #9 @F(\n" +
+ " target type = 0x13 FIELD\n" +
+ " )\n" +
+ " #10 @G(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [ARRAY]\n" +
+ " )\n" +
+ " #11 @H(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [ARRAY, ARRAY]\n" +
+ " )\n" +
+ " \n";
+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
+ }
+ // More type path tests
+ public void test045() throws Exception {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface M {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface L {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface K {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface J {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "class O1 {\n" +
+ " class O2 {\n" +
+ " class O3 {\n" +
+ " class Nested {}\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ "class X {\n" +
+ " @M O1.@L O2.@K O3.@J Nested f = null;\n" +
+ "}\n",
+ },
+ "");
+
+ String expectedOutput =
+ " // Field descriptor #6 LO1$O2$O3$Nested;\n" +
+ " O1$O2$O3$Nested f;\n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #8 @M(\n" +
+ " target type = 0x13 FIELD\n" +
+ " )\n" +
+ " #9 @L(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE]\n" +
+ " )\n" +
+ " #10 @K(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, INNER_TYPE]\n" +
+ " )\n" +
+ " #11 @J(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE]\n" +
+ " )\n" +
+ " \n";
+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
+ }
+ // More type path tests
+ public void test046() throws Exception {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "import java.util.Map;\n" +
+ "import java.util.List;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface A {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface B {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface C {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface D {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface E {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface F {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface G {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface H {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "class Document {}\n" +
+ "class X {\n" +
+ " @A Map<@B Comparable<@F Object @C [] @D [] @E[]>, @G List<@H Document>> f;\n" +
+ "}\n",
+ },
+ "");
+
+ String expectedOutput =
+ " java.util.Map f;\n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #10 @A(\n" +
+ " target type = 0x13 FIELD\n" +
+ " )\n" +
+ " #11 @B(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " #12 @F(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0), ARRAY, ARRAY, ARRAY]\n" +
+ " )\n" +
+ " #13 @C(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " #14 @D(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0), ARRAY]\n" +
+ " )\n" +
+ " #15 @E(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(0), TYPE_ARGUMENT(0), ARRAY, ARRAY]\n" +
+ " )\n" +
+ " #16 @G(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(1)]\n" +
+ " )\n" +
+ " #17 @H(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " \n";
+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
+ }
+ // More type path tests
+ public void test047() throws Exception {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface A {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface B {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface C {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface D {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface E {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface F {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface G {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface H {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "class O1 {\n" +
+ " class O2<S, T> {\n" +
+ " class O3 {\n" +
+ " class Nested<K, V> {\n" +
+ " }\n" +
+ " }\n" +
+ " }\n" +
+ "}\n" +
+ " class S {}\n" +
+ " class T {}\n" +
+ " class U {}\n" +
+ " class V {}\n" +
+ "class X {\n" +
+ " @H O1.@E O2<@F S, @G T>.@D O3.@A Nested<@B U, @C V> f;\n" +
+ "}\n",
+ },
+ "");
+
+ String expectedOutput =
+ " // Field descriptor #6 LO1$O2$O3$Nested;\n" +
+ " // Signature: LO1$O2<LS;LT;>.O3.Nested<LU;LV;>;\n" +
+ " O1$O2$O3$Nested f;\n" +
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #10 @H(\n" +
+ " target type = 0x13 FIELD\n" +
+ " )\n" +
+ " #11 @E(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE]\n" +
+ " )\n" +
+ " #12 @D(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, INNER_TYPE]\n" +
+ " )\n" +
+ " #13 @A(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE]\n" +
+ " )\n" +
+ " #14 @F(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " #15 @G(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, TYPE_ARGUMENT(1)]\n" +
+ " )\n" +
+ " #16 @B(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE, TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " #17 @C(\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE, INNER_TYPE, INNER_TYPE, TYPE_ARGUMENT(1)]\n" +
+ " )\n" +
+ " \n";
+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void test048() throws Exception {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "import java.util.List;\n" +
+ "import java.util.Map;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface Readonly {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface NonNull {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface NonEmpty {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface D {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface E {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface F {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface G {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface H {\n" +
+ " String value() default \"default\";\n" +
+ "}\n" +
+ "\n" +
+ "abstract class X implements @Readonly Map<@NonNull String, @NonEmpty List<@NonNull @Readonly String>> {}\n",
+ },
+ "");
+
+ String expectedOutput =
+ " RuntimeInvisibleTypeAnnotations: \n" +
+ " #21 @Readonly(\n" +
+ " target type = 0x10 CLASS_EXTENDS\n" +
+ " type index = 0\n" +
+ " )\n" +
+ " #22 @NonNull(\n" +
+ " target type = 0x10 CLASS_EXTENDS\n" +
+ " type index = 0\n" +
+ " location = [TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " #23 @NonEmpty(\n" +
+ " target type = 0x10 CLASS_EXTENDS\n" +
+ " type index = 0\n" +
+ " location = [TYPE_ARGUMENT(1)]\n" +
+ " )\n" +
+ " #22 @NonNull(\n" +
+ " target type = 0x10 CLASS_EXTENDS\n" +
+ " type index = 0\n" +
+ " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ " #21 @Readonly(\n" +
+ " target type = 0x10 CLASS_EXTENDS\n" +
+ " type index = 0\n" +
+ " location = [TYPE_ARGUMENT(1), TYPE_ARGUMENT(0)]\n" +
+ " )\n" +
+ "}";
+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
+ }
+ public void test049() throws Exception {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@Retention(RetentionPolicy.RUNTIME)\n" +
+ "@interface B { int value() default -1; }\n" +
+ "public class X {\n" +
+ " class Y {\n" +
+ " }\n" +
+ " @B(1) X. @B(2) Y xy;\n" +
+ " void foo(@B(3) X. @B(4) Y xy) {\n" +
+ " @B(5) X. @B(6) Y local = null; \n" +
+ " }\n" +
+ "}\n",
+ },
+ "");
+
+ String expectedOutput =
+ " // Field descriptor #6 LX$Y;\n" +
+ " X$Y xy;\n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
+ " #8 @B(\n" +
+ " #9 value=(int) 1 (constant type)\n" +
+ " target type = 0x13 FIELD\n" +
+ " )\n" +
+ " #8 @B(\n" +
+ " #9 value=(int) 2 (constant type)\n" +
+ " target type = 0x13 FIELD\n" +
+ " location = [INNER_TYPE]\n" +
+ " )\n" +
+ " \n" +
+ " // Method descriptor #13 ()V\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public X();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 invokespecial java.lang.Object() [15]\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 5]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 5] local: this index: 0 type: X\n" +
+ " \n" +
+ " // Method descriptor #22 (LX$Y;)V\n" +
+ " // Stack: 1, Locals: 3\n" +
+ " void foo(X.Y xy);\n" +
+ " 0 aconst_null\n" +
+ " 1 astore_2 [local]\n" +
+ " 2 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 10]\n" +
+ " [pc: 2, line: 11]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 3] local: this index: 0 type: X\n" +
+ " [pc: 0, pc: 3] local: xy index: 1 type: X.Y\n" +
+ " [pc: 2, pc: 3] local: local index: 2 type: X.Y\n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
+ " #8 @B(\n" +
+ " #9 value=(int) 5 (constant type)\n" +
+ " target type = 0x40 LOCAL_VARIABLE\n" +
+ " local variable entries:\n" +
+ " [pc: 2, pc: 3] index: 2\n" +
+ " )\n" +
+ " #8 @B(\n" +
+ " #9 value=(int) 6 (constant type)\n" +
+ " target type = 0x40 LOCAL_VARIABLE\n" +
+ " local variable entries:\n" +
+ " [pc: 2, pc: 3] index: 2\n" +
+ " location = [INNER_TYPE]\n" +
+ " )\n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
+ " #8 @B(\n" +
+ " #9 value=(int) 3 (constant type)\n" +
+ " target type = 0x16 METHOD_FORMAL_PARAMETER\n" +
+ " method parameter index = 0\n" +
+ " )\n" +
+ " #8 @B(\n" +
+ " #9 value=(int) 4 (constant type)\n" +
+ " target type = 0x16 METHOD_FORMAL_PARAMETER\n" +
+ " method parameter index = 0\n" +
+ " location = [INNER_TYPE]\n" +
+ " )\n" +
+ "\n";
+ checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "Z", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr335ClassFileTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr335ClassFileTest.java
index 98cfcde..8aaf084 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr335ClassFileTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr335ClassFileTest.java
@@ -11,6 +11,7 @@
*
* Contributors:
* Jesper Steen Moller - initial API and implementation
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
@@ -52,6 +53,7 @@
int index = result.indexOf(expectedOutput);
if (index == -1 || expectedOutput.length() == 0) {
System.out.println(Util.displayString(result, 3));
+ System.out.println("...");
}
if (index == -1) {
assertEquals("Wrong contents", expectedOutput, result);
@@ -90,10 +92,10 @@
" constant #9 utf8: \"Code\"\n" +
" constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
" constant #11 name_and_type: #7.#8 <init> ()V\n" +
- " constant #12 name_and_type: #13.#14 lambda ()Ljava/lang/Runnable;\n" +
- " constant #13 utf8: \"lambda\"\n" +
+ " constant #12 name_and_type: #13.#14 run ()Ljava/lang/Runnable;\n" +
+ " constant #13 utf8: \"run\"\n" +
" constant #14 utf8: \"()Ljava/lang/Runnable;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda ()Ljava/lang/Runnable;\n" +
+ " constant #15 invoke dynamic: #0 #12 run ()Ljava/lang/Runnable;\n" +
" constant #16 field_ref: #1.#17 X.referenceExpression Ljava/lang/Runnable;\n" +
" constant #17 name_and_type: #5.#6 referenceExpression Ljava/lang/Runnable;\n" +
" constant #18 utf8: \"LineNumberTable\"\n" +
@@ -102,33 +104,28 @@
" constant #21 utf8: \"LX;\"\n" +
" constant #22 utf8: \"SourceFile\"\n" +
" constant #23 utf8: \"X.java\"\n" +
- " constant #24 method_ref: #25.#27 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #24 method_ref: #25.#27 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #25 class: #26 java/lang/invoke/LambdaMetafactory\n" +
" constant #26 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #27 name_and_type: #28.#29 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #28 utf8: \"metaFactory\"\n" +
- " constant #29 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #27 name_and_type: #28.#29 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #28 utf8: \"metafactory\"\n" +
+ " constant #29 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #30 method handle: invokestatic (6) #24 \n" +
" constant #31 utf8: \"BootstrapMethods\"\n" +
- " constant #32 interface_method_ref: #33.#35 java/lang/Runnable.run ()V\n" +
- " constant #33 class: #34 java/lang/Runnable\n" +
- " constant #34 utf8: \"java/lang/Runnable\"\n" +
- " constant #35 name_and_type: #36.#8 run ()V\n" +
- " constant #36 utf8: \"run\"\n" +
- " constant #37 method handle: invokeinterface (9) #32 \n" +
- " constant #38 method_ref: #39.#41 java/lang/Thread.yield ()V\n" +
- " constant #39 class: #40 java/lang/Thread\n" +
- " constant #40 utf8: \"java/lang/Thread\"\n" +
- " constant #41 name_and_type: #42.#8 yield ()V\n" +
- " constant #42 utf8: \"yield\"\n" +
- " constant #43 method handle: invokestatic (6) #38 \n" +
- " constant #44 method type: #8 ()V\n" +
- " constant #45 utf8: \"InnerClasses\"\n" +
- " constant #46 class: #47 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #47 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #48 class: #49 java/lang/invoke/MethodHandles\n" +
- " constant #49 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #50 utf8: \"Lookup\"\n" +
+ " constant #32 method type: #8 ()V\n" +
+ " constant #33 method_ref: #34.#36 java/lang/Thread.yield ()V\n" +
+ " constant #34 class: #35 java/lang/Thread\n" +
+ " constant #35 utf8: \"java/lang/Thread\"\n" +
+ " constant #36 name_and_type: #37.#8 yield ()V\n" +
+ " constant #37 utf8: \"yield\"\n" +
+ " constant #38 method handle: invokestatic (6) #33 \n" +
+ " constant #39 method type: #8 ()V\n" +
+ " constant #40 utf8: \"InnerClasses\"\n" +
+ " constant #41 class: #42 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #42 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #43 class: #44 java/lang/invoke/MethodHandles\n" +
+ " constant #44 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #45 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 Ljava/lang/Runnable;\n" +
" public java.lang.Runnable referenceExpression;\n" +
@@ -139,7 +136,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [10]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda() : java.lang.Runnable [15]\n" +
+ " 5 invokedynamic 0 run() : java.lang.Runnable [15]\n" +
" 10 putfield X.referenceExpression : java.lang.Runnable [16]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -150,10 +147,10 @@
" [pc: 0, pc: 14] local: this index: 0 type: X\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #46 java/lang/invoke/MethodHandles$Lookup, outer class info: #48 java/lang/invoke/MethodHandles\n" +
- " inner name: #50 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #41 java/lang/invoke/MethodHandles$Lookup, outer class info: #43 java/lang/invoke/MethodHandles\n" +
+ " inner name: #45 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 30 arguments: {#37,#43,#44}\n" +
+ " 0 : # 30 arguments: {#32,#38,#39}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -183,86 +180,81 @@
);
String expectedOutput =
- "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" +
- "public class X {\n" +
- " Constant pool:\n" +
- " constant #1 class: #2 X\n" +
- " constant #2 utf8: \"X\"\n" +
- " constant #3 class: #4 java/lang/Object\n" +
- " constant #4 utf8: \"java/lang/Object\"\n" +
- " constant #5 utf8: \"referenceExpression\"\n" +
- " constant #6 utf8: \"LObjectConsumer;\"\n" +
- " constant #7 utf8: \"<init>\"\n" +
- " constant #8 utf8: \"()V\"\n" +
- " constant #9 utf8: \"Code\"\n" +
- " constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
- " constant #11 name_and_type: #7.#8 <init> ()V\n" +
- " constant #12 name_and_type: #13.#14 lambda ()LObjectConsumer;\n" +
- " constant #13 utf8: \"lambda\"\n" +
- " constant #14 utf8: \"()LObjectConsumer;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda ()LObjectConsumer;\n" +
- " constant #16 field_ref: #1.#17 X.referenceExpression LObjectConsumer;\n" +
- " constant #17 name_and_type: #5.#6 referenceExpression LObjectConsumer;\n" +
- " constant #18 utf8: \"LineNumberTable\"\n" +
- " constant #19 utf8: \"LocalVariableTable\"\n" +
- " constant #20 utf8: \"this\"\n" +
- " constant #21 utf8: \"LX;\"\n" +
- " constant #22 utf8: \"SourceFile\"\n" +
- " constant #23 utf8: \"X.java\"\n" +
- " constant #24 method_ref: #25.#27 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #25 class: #26 java/lang/invoke/LambdaMetafactory\n" +
- " constant #26 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #27 name_and_type: #28.#29 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #28 utf8: \"metaFactory\"\n" +
- " constant #29 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
- " constant #30 method handle: invokestatic (6) #24 \n" +
- " constant #31 utf8: \"BootstrapMethods\"\n" +
- " constant #32 interface_method_ref: #33.#35 ObjectConsumer.consume (Ljava/lang/Object;)V\n" +
- " constant #33 class: #34 ObjectConsumer\n" +
- " constant #34 utf8: \"ObjectConsumer\"\n" +
- " constant #35 name_and_type: #36.#37 consume (Ljava/lang/Object;)V\n" +
- " constant #36 utf8: \"consume\"\n" +
- " constant #37 utf8: \"(Ljava/lang/Object;)V\"\n" +
- " constant #38 method handle: invokeinterface (9) #32 \n" +
- " constant #39 method_ref: #40.#42 Main.printIt (Ljava/lang/Object;)V\n" +
- " constant #40 class: #41 Main\n" +
- " constant #41 utf8: \"Main\"\n" +
- " constant #42 name_and_type: #43.#37 printIt (Ljava/lang/Object;)V\n" +
- " constant #43 utf8: \"printIt\"\n" +
- " constant #44 method handle: invokestatic (6) #39 \n" +
- " constant #45 method type: #37 (Ljava/lang/Object;)V\n" +
- " constant #46 utf8: \"InnerClasses\"\n" +
- " constant #47 class: #48 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #48 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #49 class: #50 java/lang/invoke/MethodHandles\n" +
- " constant #50 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #51 utf8: \"Lookup\"\n" +
- " \n" +
- " // Field descriptor #6 LObjectConsumer;\n" +
- " public ObjectConsumer referenceExpression;\n" +
- " \n" +
- " // Method descriptor #8 ()V\n" +
- " // Stack: 2, Locals: 1\n" +
- " public X();\n" +
- " 0 aload_0 [this]\n" +
- " 1 invokespecial java.lang.Object() [10]\n" +
- " 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda() : ObjectConsumer [15]\n" +
- " 10 putfield X.referenceExpression : ObjectConsumer [16]\n" +
- " 13 return\n" +
- " Line numbers:\n" +
- " [pc: 0, line: 1]\n" +
- " [pc: 4, line: 2]\n" +
- " [pc: 13, line: 1]\n" +
- " Local variable table:\n" +
- " [pc: 0, pc: 14] local: this index: 0 type: X\n" +
- "\n" +
- " Inner classes:\n" +
- " [inner class info: #47 java/lang/invoke/MethodHandles$Lookup, outer class info: #49 java/lang/invoke/MethodHandles\n" +
- " inner name: #51 Lookup, accessflags: 25 public static final]\n" +
- "Bootstrap methods:\n" +
- " 0 : # 30 arguments: {#38,#44,#45}\n" +
- "}";
+ "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" +
+ "public class X {\n" +
+ " Constant pool:\n" +
+ " constant #1 class: #2 X\n" +
+ " constant #2 utf8: \"X\"\n" +
+ " constant #3 class: #4 java/lang/Object\n" +
+ " constant #4 utf8: \"java/lang/Object\"\n" +
+ " constant #5 utf8: \"referenceExpression\"\n" +
+ " constant #6 utf8: \"LObjectConsumer;\"\n" +
+ " constant #7 utf8: \"<init>\"\n" +
+ " constant #8 utf8: \"()V\"\n" +
+ " constant #9 utf8: \"Code\"\n" +
+ " constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
+ " constant #11 name_and_type: #7.#8 <init> ()V\n" +
+ " constant #12 name_and_type: #13.#14 consume ()LObjectConsumer;\n" +
+ " constant #13 utf8: \"consume\"\n" +
+ " constant #14 utf8: \"()LObjectConsumer;\"\n" +
+ " constant #15 invoke dynamic: #0 #12 consume ()LObjectConsumer;\n" +
+ " constant #16 field_ref: #1.#17 X.referenceExpression LObjectConsumer;\n" +
+ " constant #17 name_and_type: #5.#6 referenceExpression LObjectConsumer;\n" +
+ " constant #18 utf8: \"LineNumberTable\"\n" +
+ " constant #19 utf8: \"LocalVariableTable\"\n" +
+ " constant #20 utf8: \"this\"\n" +
+ " constant #21 utf8: \"LX;\"\n" +
+ " constant #22 utf8: \"SourceFile\"\n" +
+ " constant #23 utf8: \"X.java\"\n" +
+ " constant #24 method_ref: #25.#27 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #25 class: #26 java/lang/invoke/LambdaMetafactory\n" +
+ " constant #26 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
+ " constant #27 name_and_type: #28.#29 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #28 utf8: \"metafactory\"\n" +
+ " constant #29 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #30 method handle: invokestatic (6) #24 \n" +
+ " constant #31 utf8: \"BootstrapMethods\"\n" +
+ " constant #32 utf8: \"(Ljava/lang/Object;)V\"\n" +
+ " constant #33 method type: #32 (Ljava/lang/Object;)V\n" +
+ " constant #34 method_ref: #35.#37 Main.printIt (Ljava/lang/Object;)V\n" +
+ " constant #35 class: #36 Main\n" +
+ " constant #36 utf8: \"Main\"\n" +
+ " constant #37 name_and_type: #38.#32 printIt (Ljava/lang/Object;)V\n" +
+ " constant #38 utf8: \"printIt\"\n" +
+ " constant #39 method handle: invokestatic (6) #34 \n" +
+ " constant #40 method type: #32 (Ljava/lang/Object;)V\n" +
+ " constant #41 utf8: \"InnerClasses\"\n" +
+ " constant #42 class: #43 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #43 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #44 class: #45 java/lang/invoke/MethodHandles\n" +
+ " constant #45 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #46 utf8: \"Lookup\"\n" +
+ " \n" +
+ " // Field descriptor #6 LObjectConsumer;\n" +
+ " public ObjectConsumer referenceExpression;\n" +
+ " \n" +
+ " // Method descriptor #8 ()V\n" +
+ " // Stack: 2, Locals: 1\n" +
+ " public X();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 invokespecial java.lang.Object() [10]\n" +
+ " 4 aload_0 [this]\n" +
+ " 5 invokedynamic 0 consume() : ObjectConsumer [15]\n" +
+ " 10 putfield X.referenceExpression : ObjectConsumer [16]\n" +
+ " 13 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " [pc: 4, line: 2]\n" +
+ " [pc: 13, line: 1]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 14] local: this index: 0 type: X\n" +
+ "\n" +
+ " Inner classes:\n" +
+ " [inner class info: #42 java/lang/invoke/MethodHandles$Lookup, outer class info: #44 java/lang/invoke/MethodHandles\n" +
+ " inner name: #46 Lookup, accessflags: 25 public static final]\n" +
+ "Bootstrap methods:\n" +
+ " 0 : # 30 arguments: {#33,#39,#40}\n" +
+ "}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
}
@@ -306,10 +298,10 @@
" constant #9 utf8: \"Code\"\n" +
" constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
" constant #11 name_and_type: #7.#8 <init> ()V\n" +
- " constant #12 name_and_type: #13.#14 lambda ()LObjectToString;\n" +
- " constant #13 utf8: \"lambda\"\n" +
+ " constant #12 name_and_type: #13.#14 makeString ()LObjectToString;\n" +
+ " constant #13 utf8: \"makeString\"\n" +
" constant #14 utf8: \"()LObjectToString;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda ()LObjectToString;\n" +
+ " constant #15 invoke dynamic: #0 #12 makeString ()LObjectToString;\n" +
" constant #16 field_ref: #1.#17 X.referenceExpression LObjectToString;\n" +
" constant #17 name_and_type: #5.#6 referenceExpression LObjectToString;\n" +
" constant #18 utf8: \"LineNumberTable\"\n" +
@@ -318,33 +310,28 @@
" constant #21 utf8: \"LX;\"\n" +
" constant #22 utf8: \"SourceFile\"\n" +
" constant #23 utf8: \"X.java\"\n" +
- " constant #24 method_ref: #25.#27 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #24 method_ref: #25.#27 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #25 class: #26 java/lang/invoke/LambdaMetafactory\n" +
" constant #26 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #27 name_and_type: #28.#29 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #28 utf8: \"metaFactory\"\n" +
- " constant #29 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #27 name_and_type: #28.#29 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #28 utf8: \"metafactory\"\n" +
+ " constant #29 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #30 method handle: invokestatic (6) #24 \n" +
" constant #31 utf8: \"BootstrapMethods\"\n" +
- " constant #32 interface_method_ref: #33.#35 ObjectToString.makeString (Ljava/lang/Object;)Ljava/lang/String;\n" +
- " constant #33 class: #34 ObjectToString\n" +
- " constant #34 utf8: \"ObjectToString\"\n" +
- " constant #35 name_and_type: #36.#37 makeString (Ljava/lang/Object;)Ljava/lang/String;\n" +
- " constant #36 utf8: \"makeString\"\n" +
- " constant #37 utf8: \"(Ljava/lang/Object;)Ljava/lang/String;\"\n" +
- " constant #38 method handle: invokeinterface (9) #32 \n" +
- " constant #39 method_ref: #3.#40 java/lang/Object.toString ()Ljava/lang/String;\n" +
- " constant #40 name_and_type: #41.#42 toString ()Ljava/lang/String;\n" +
- " constant #41 utf8: \"toString\"\n" +
- " constant #42 utf8: \"()Ljava/lang/String;\"\n" +
- " constant #43 method handle: invokevirtual (5) #39 \n" +
- " constant #44 method type: #37 (Ljava/lang/Object;)Ljava/lang/String;\n" +
- " constant #45 utf8: \"InnerClasses\"\n" +
- " constant #46 class: #47 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #47 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #48 class: #49 java/lang/invoke/MethodHandles\n" +
- " constant #49 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #50 utf8: \"Lookup\"\n" +
+ " constant #32 utf8: \"(Ljava/lang/Object;)Ljava/lang/String;\"\n" +
+ " constant #33 method type: #32 (Ljava/lang/Object;)Ljava/lang/String;\n" +
+ " constant #34 method_ref: #3.#35 java/lang/Object.toString ()Ljava/lang/String;\n" +
+ " constant #35 name_and_type: #36.#37 toString ()Ljava/lang/String;\n" +
+ " constant #36 utf8: \"toString\"\n" +
+ " constant #37 utf8: \"()Ljava/lang/String;\"\n" +
+ " constant #38 method handle: invokevirtual (5) #34 \n" +
+ " constant #39 method type: #32 (Ljava/lang/Object;)Ljava/lang/String;\n" +
+ " constant #40 utf8: \"InnerClasses\"\n" +
+ " constant #41 class: #42 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #42 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #43 class: #44 java/lang/invoke/MethodHandles\n" +
+ " constant #44 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #45 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LObjectToString;\n" +
" public ObjectToString referenceExpression;\n" +
@@ -355,7 +342,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [10]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda() : ObjectToString [15]\n" +
+ " 5 invokedynamic 0 makeString() : ObjectToString [15]\n" +
" 10 putfield X.referenceExpression : ObjectToString [16]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -366,10 +353,10 @@
" [pc: 0, pc: 14] local: this index: 0 type: X\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #46 java/lang/invoke/MethodHandles$Lookup, outer class info: #48 java/lang/invoke/MethodHandles\n" +
- " inner name: #50 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #41 java/lang/invoke/MethodHandles$Lookup, outer class info: #43 java/lang/invoke/MethodHandles\n" +
+ " inner name: #45 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 30 arguments: {#38,#43,#44}\n" +
+ " 0 : # 30 arguments: {#33,#38,#39}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -417,10 +404,10 @@
" constant #15 utf8: \"SUCCESS\"\n" +
" constant #16 field_ref: #1.#17 X.s Ljava/lang/String;\n" +
" constant #17 name_and_type: #5.#6 s Ljava/lang/String;\n" +
- " constant #18 name_and_type: #19.#20 lambda (Ljava/lang/String;)LStringProducer;\n" +
- " constant #19 utf8: \"lambda\"\n" +
+ " constant #18 name_and_type: #19.#20 produce (Ljava/lang/String;)LStringProducer;\n" +
+ " constant #19 utf8: \"produce\"\n" +
" constant #20 utf8: \"(Ljava/lang/String;)LStringProducer;\"\n" +
- " constant #21 invoke dynamic: #0 #18 lambda (Ljava/lang/String;)LStringProducer;\n" +
+ " constant #21 invoke dynamic: #0 #18 produce (Ljava/lang/String;)LStringProducer;\n" +
" constant #22 field_ref: #1.#23 X.referenceExpression LStringProducer;\n" +
" constant #23 name_and_type: #7.#8 referenceExpression LStringProducer;\n" +
" constant #24 utf8: \"LineNumberTable\"\n" +
@@ -429,34 +416,29 @@
" constant #27 utf8: \"LX;\"\n" +
" constant #28 utf8: \"SourceFile\"\n" +
" constant #29 utf8: \"X.java\"\n" +
- " constant #30 method_ref: #31.#33 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #30 method_ref: #31.#33 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #31 class: #32 java/lang/invoke/LambdaMetafactory\n" +
" constant #32 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #33 name_and_type: #34.#35 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #34 utf8: \"metaFactory\"\n" +
- " constant #35 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #33 name_and_type: #34.#35 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #34 utf8: \"metafactory\"\n" +
+ " constant #35 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #36 method handle: invokestatic (6) #30 \n" +
" constant #37 utf8: \"BootstrapMethods\"\n" +
- " constant #38 interface_method_ref: #39.#41 StringProducer.produce ()Ljava/lang/String;\n" +
- " constant #39 class: #40 StringProducer\n" +
- " constant #40 utf8: \"StringProducer\"\n" +
- " constant #41 name_and_type: #42.#43 produce ()Ljava/lang/String;\n" +
- " constant #42 utf8: \"produce\"\n" +
- " constant #43 utf8: \"()Ljava/lang/String;\"\n" +
- " constant #44 method handle: invokeinterface (9) #38 \n" +
- " constant #45 method_ref: #46.#48 java/lang/String.toString ()Ljava/lang/String;\n" +
- " constant #46 class: #47 java/lang/String\n" +
- " constant #47 utf8: \"java/lang/String\"\n" +
- " constant #48 name_and_type: #49.#43 toString ()Ljava/lang/String;\n" +
- " constant #49 utf8: \"toString\"\n" +
- " constant #50 method handle: invokevirtual (5) #45 \n" +
- " constant #51 method type: #43 ()Ljava/lang/String;\n" +
- " constant #52 utf8: \"InnerClasses\"\n" +
- " constant #53 class: #54 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #54 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #55 class: #56 java/lang/invoke/MethodHandles\n" +
- " constant #56 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #57 utf8: \"Lookup\"\n" +
+ " constant #38 utf8: \"()Ljava/lang/String;\"\n" +
+ " constant #39 method type: #38 ()Ljava/lang/String;\n" +
+ " constant #40 method_ref: #41.#43 java/lang/String.toString ()Ljava/lang/String;\n" +
+ " constant #41 class: #42 java/lang/String\n" +
+ " constant #42 utf8: \"java/lang/String\"\n" +
+ " constant #43 name_and_type: #44.#38 toString ()Ljava/lang/String;\n" +
+ " constant #44 utf8: \"toString\"\n" +
+ " constant #45 method handle: invokevirtual (5) #40 \n" +
+ " constant #46 method type: #38 ()Ljava/lang/String;\n" +
+ " constant #47 utf8: \"InnerClasses\"\n" +
+ " constant #48 class: #49 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #49 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #50 class: #51 java/lang/invoke/MethodHandles\n" +
+ " constant #51 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #52 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 Ljava/lang/String;\n" +
" java.lang.String s;\n" +
@@ -475,7 +457,7 @@
" 10 aload_0 [this]\n" +
" 11 aload_0 [this]\n" +
" 12 getfield X.s : java.lang.String [16]\n" +
- " 15 invokedynamic 0 lambda(java.lang.String) : StringProducer [21]\n" +
+ " 15 invokedynamic 0 produce(java.lang.String) : StringProducer [21]\n" +
" 20 putfield X.referenceExpression : StringProducer [22]\n" +
" 23 return\n" +
" Line numbers:\n" +
@@ -487,10 +469,10 @@
" [pc: 0, pc: 24] local: this index: 0 type: X\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #53 java/lang/invoke/MethodHandles$Lookup, outer class info: #55 java/lang/invoke/MethodHandles\n" +
- " inner name: #57 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #48 java/lang/invoke/MethodHandles$Lookup, outer class info: #50 java/lang/invoke/MethodHandles\n" +
+ " inner name: #52 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 36 arguments: {#44,#50,#51}\n" +
+ " 0 : # 36 arguments: {#39,#45,#46}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -519,7 +501,7 @@
},
"SUCCESS"
);
- verifyClassFile("// Compiled from X.java (version 1.8 : 52.0, super bit)\n" +
+ verifyClassFile( "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" +
"public class X {\n" +
" Constant pool:\n" +
" constant #1 class: #2 X\n" +
@@ -531,10 +513,10 @@
" constant #7 utf8: \"<clinit>\"\n" +
" constant #8 utf8: \"()V\"\n" +
" constant #9 utf8: \"Code\"\n" +
- " constant #10 name_and_type: #11.#12 lambda ()LMainProducer;\n" +
- " constant #11 utf8: \"lambda\"\n" +
+ " constant #10 name_and_type: #11.#12 produce ()LMainProducer;\n" +
+ " constant #11 utf8: \"produce\"\n" +
" constant #12 utf8: \"()LMainProducer;\"\n" +
- " constant #13 invoke dynamic: #0 #10 lambda ()LMainProducer;\n" +
+ " constant #13 invoke dynamic: #0 #10 produce ()LMainProducer;\n" +
" constant #14 field_ref: #1.#15 X.allocatorExpression LMainProducer;\n" +
" constant #15 name_and_type: #5.#6 allocatorExpression LMainProducer;\n" +
" constant #16 utf8: \"LineNumberTable\"\n" +
@@ -546,32 +528,27 @@
" constant #22 utf8: \"LX;\"\n" +
" constant #23 utf8: \"SourceFile\"\n" +
" constant #24 utf8: \"X.java\"\n" +
- " constant #25 method_ref: #26.#28 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #25 method_ref: #26.#28 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #26 class: #27 java/lang/invoke/LambdaMetafactory\n" +
" constant #27 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #28 name_and_type: #29.#30 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #29 utf8: \"metaFactory\"\n" +
- " constant #30 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #28 name_and_type: #29.#30 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #29 utf8: \"metafactory\"\n" +
+ " constant #30 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #31 method handle: invokestatic (6) #25 \n" +
" constant #32 utf8: \"BootstrapMethods\"\n" +
- " constant #33 interface_method_ref: #34.#36 MainProducer.produce ()LMain;\n" +
- " constant #34 class: #35 MainProducer\n" +
- " constant #35 utf8: \"MainProducer\"\n" +
- " constant #36 name_and_type: #37.#38 produce ()LMain;\n" +
- " constant #37 utf8: \"produce\"\n" +
- " constant #38 utf8: \"()LMain;\"\n" +
- " constant #39 method handle: invokeinterface (9) #33 \n" +
- " constant #40 method_ref: #41.#20 Main.<init> ()V\n" +
- " constant #41 class: #42 Main\n" +
- " constant #42 utf8: \"Main\"\n" +
- " constant #43 method handle: newinvokespecial (8) #40 \n" +
- " constant #44 method type: #38 ()LMain;\n" +
- " constant #45 utf8: \"InnerClasses\"\n" +
- " constant #46 class: #47 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #47 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #48 class: #49 java/lang/invoke/MethodHandles\n" +
- " constant #49 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #50 utf8: \"Lookup\"\n" +
+ " constant #33 utf8: \"()LMain;\"\n" +
+ " constant #34 method type: #33 ()LMain;\n" +
+ " constant #35 method_ref: #36.#20 Main.<init> ()V\n" +
+ " constant #36 class: #37 Main\n" +
+ " constant #37 utf8: \"Main\"\n" +
+ " constant #38 method handle: newinvokespecial (8) #35 \n" +
+ " constant #39 method type: #33 ()LMain;\n" +
+ " constant #40 utf8: \"InnerClasses\"\n" +
+ " constant #41 class: #42 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #42 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #43 class: #44 java/lang/invoke/MethodHandles\n" +
+ " constant #44 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #45 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LMainProducer;\n" +
" public static MainProducer allocatorExpression;\n" +
@@ -579,7 +556,7 @@
" // Method descriptor #8 ()V\n" +
" // Stack: 1, Locals: 0\n" +
" static {};\n" +
- " 0 invokedynamic 0 lambda() : MainProducer [13]\n" +
+ " 0 invokedynamic 0 produce() : MainProducer [13]\n" +
" 5 putstatic X.allocatorExpression : MainProducer [14]\n" +
" 8 return\n" +
" Line numbers:\n" +
@@ -597,10 +574,10 @@
" [pc: 0, pc: 5] local: this index: 0 type: X\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #46 java/lang/invoke/MethodHandles$Lookup, outer class info: #48 java/lang/invoke/MethodHandles\n" +
- " inner name: #50 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #41 java/lang/invoke/MethodHandles$Lookup, outer class info: #43 java/lang/invoke/MethodHandles\n" +
+ " inner name: #45 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 31 arguments: {#39,#43,#44}\n" +
+ " 0 : # 31 arguments: {#34,#38,#39}\n" +
"}", "X.class", ClassFileBytesDisassembler.SYSTEM);
}
public void test006() throws Exception {
@@ -632,7 +609,8 @@
},
"SUCCESS"
);
- String expected = "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" +
+ String expected =
+ "// Compiled from X.java (version 1.8 : 52.0, super bit)\n" +
"public class X {\n" +
" Constant pool:\n" +
" constant #1 class: #2 X\n" +
@@ -646,10 +624,10 @@
" constant #9 utf8: \"<clinit>\"\n" +
" constant #10 utf8: \"()V\"\n" +
" constant #11 utf8: \"Code\"\n" +
- " constant #12 name_and_type: #13.#14 lambda ()LFunction2;\n" +
- " constant #13 utf8: \"lambda\"\n" +
+ " constant #12 name_and_type: #13.#14 apply ()LFunction2;\n" +
+ " constant #13 utf8: \"apply\"\n" +
" constant #14 utf8: \"()LFunction2;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda ()LFunction2;\n" +
+ " constant #15 invoke dynamic: #0 #12 apply ()LFunction2;\n" +
" constant #16 field_ref: #1.#17 X.producer LFunction2;\n" +
" constant #17 name_and_type: #5.#6 producer LFunction2;\n" +
" constant #18 utf8: \"LineNumberTable\"\n" +
@@ -661,35 +639,30 @@
" constant #24 utf8: \"LX;\"\n" +
" constant #25 utf8: \"SourceFile\"\n" +
" constant #26 utf8: \"X.java\"\n" +
- " constant #27 method_ref: #28.#30 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #27 method_ref: #28.#30 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #28 class: #29 java/lang/invoke/LambdaMetafactory\n" +
" constant #29 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #30 name_and_type: #31.#32 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #31 utf8: \"metaFactory\"\n" +
- " constant #32 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #30 name_and_type: #31.#32 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #31 utf8: \"metafactory\"\n" +
+ " constant #32 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #33 method handle: invokestatic (6) #27 \n" +
" constant #34 utf8: \"BootstrapMethods\"\n" +
- " constant #35 interface_method_ref: #36.#38 Function2.apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #36 class: #37 Function2\n" +
- " constant #37 utf8: \"Function2\"\n" +
- " constant #38 name_and_type: #39.#40 apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #39 utf8: \"apply\"\n" +
- " constant #40 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
- " constant #41 method handle: invokeinterface (9) #35 \n" +
- " constant #42 method_ref: #43.#45 Main.<init> (Ljava/lang/String;Ljava/lang/String;)V\n" +
- " constant #43 class: #44 Main\n" +
- " constant #44 utf8: \"Main\"\n" +
- " constant #45 name_and_type: #20.#46 <init> (Ljava/lang/String;Ljava/lang/String;)V\n" +
- " constant #46 utf8: \"(Ljava/lang/String;Ljava/lang/String;)V\"\n" +
- " constant #47 method handle: newinvokespecial (8) #42 \n" +
- " constant #48 utf8: \"(Ljava/lang/String;Ljava/lang/String;)LMain;\"\n" +
- " constant #49 method type: #48 (Ljava/lang/String;Ljava/lang/String;)LMain;\n" +
- " constant #50 utf8: \"InnerClasses\"\n" +
- " constant #51 class: #52 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #52 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #53 class: #54 java/lang/invoke/MethodHandles\n" +
- " constant #54 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #55 utf8: \"Lookup\"\n" +
+ " constant #35 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
+ " constant #36 method type: #35 (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
+ " constant #37 method_ref: #38.#40 Main.<init> (Ljava/lang/String;Ljava/lang/String;)V\n" +
+ " constant #38 class: #39 Main\n" +
+ " constant #39 utf8: \"Main\"\n" +
+ " constant #40 name_and_type: #20.#41 <init> (Ljava/lang/String;Ljava/lang/String;)V\n" +
+ " constant #41 utf8: \"(Ljava/lang/String;Ljava/lang/String;)V\"\n" +
+ " constant #42 method handle: newinvokespecial (8) #37 \n" +
+ " constant #43 utf8: \"(Ljava/lang/String;Ljava/lang/String;)LMain;\"\n" +
+ " constant #44 method type: #43 (Ljava/lang/String;Ljava/lang/String;)LMain;\n" +
+ " constant #45 utf8: \"InnerClasses\"\n" +
+ " constant #46 class: #47 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #47 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #48 class: #49 java/lang/invoke/MethodHandles\n" +
+ " constant #49 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #50 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LFunction2;\n" +
" // Signature: LFunction2<LMain;Ljava/lang/String;Ljava/lang/String;>;\n" +
@@ -698,7 +671,7 @@
" // Method descriptor #10 ()V\n" +
" // Stack: 1, Locals: 0\n" +
" static {};\n" +
- " 0 invokedynamic 0 lambda() : Function2 [15]\n" +
+ " 0 invokedynamic 0 apply() : Function2 [15]\n" +
" 5 putstatic X.producer : Function2 [16]\n" +
" 8 return\n" +
" Line numbers:\n" +
@@ -716,10 +689,10 @@
" [pc: 0, pc: 5] local: this index: 0 type: X\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #51 java/lang/invoke/MethodHandles$Lookup, outer class info: #53 java/lang/invoke/MethodHandles\n" +
- " inner name: #55 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #46 java/lang/invoke/MethodHandles$Lookup, outer class info: #48 java/lang/invoke/MethodHandles\n" +
+ " inner name: #50 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 33 arguments: {#41,#47,#49}\n" +
+ " 0 : # 33 arguments: {#36,#42,#44}\n" +
"}";
verifyClassFile(expected, "X.class", ClassFileBytesDisassembler.SYSTEM);
}
@@ -757,10 +730,10 @@
" constant #9 utf8: \"Code\"\n" +
" constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
" constant #11 name_and_type: #7.#8 <init> ()V\n" +
- " constant #12 name_and_type: #13.#14 lambda$ ()Ljava/lang/Runnable;\n" +
- " constant #13 utf8: \"lambda$\"\n" +
+ " constant #12 name_and_type: #13.#14 run ()Ljava/lang/Runnable;\n" +
+ " constant #13 utf8: \"run\"\n" +
" constant #14 utf8: \"()Ljava/lang/Runnable;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda$ ()Ljava/lang/Runnable;\n" +
+ " constant #15 invoke dynamic: #0 #12 run ()Ljava/lang/Runnable;\n" +
" constant #16 field_ref: #1.#17 X.referenceExpression Ljava/lang/Runnable;\n" +
" constant #17 name_and_type: #5.#6 referenceExpression Ljava/lang/Runnable;\n" +
" constant #18 utf8: \"LineNumberTable\"\n" +
@@ -784,30 +757,25 @@
" constant #36 utf8: \"(Ljava/lang/String;)V\"\n" +
" constant #37 utf8: \"SourceFile\"\n" +
" constant #38 utf8: \"X.java\"\n" +
- " constant #39 method_ref: #40.#42 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #39 method_ref: #40.#42 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #40 class: #41 java/lang/invoke/LambdaMetafactory\n" +
" constant #41 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #42 name_and_type: #43.#44 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #43 utf8: \"metaFactory\"\n" +
- " constant #44 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #42 name_and_type: #43.#44 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #43 utf8: \"metafactory\"\n" +
+ " constant #44 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #45 method handle: invokestatic (6) #39 \n" +
" constant #46 utf8: \"BootstrapMethods\"\n" +
- " constant #47 interface_method_ref: #48.#50 java/lang/Runnable.run ()V\n" +
- " constant #48 class: #49 java/lang/Runnable\n" +
- " constant #49 utf8: \"java/lang/Runnable\"\n" +
- " constant #50 name_and_type: #51.#8 run ()V\n" +
- " constant #51 utf8: \"run\"\n" +
- " constant #52 method handle: invokeinterface (9) #47 \n" +
- " constant #53 method_ref: #1.#54 X.lambda$0 ()V\n" +
- " constant #54 name_and_type: #22.#8 lambda$0 ()V\n" +
- " constant #55 method handle: invokestatic (6) #53 \n" +
- " constant #56 method type: #8 ()V\n" +
- " constant #57 utf8: \"InnerClasses\"\n" +
- " constant #58 class: #59 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #59 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #60 class: #61 java/lang/invoke/MethodHandles\n" +
- " constant #61 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #62 utf8: \"Lookup\"\n" +
+ " constant #47 method type: #8 ()V\n" +
+ " constant #48 method_ref: #1.#49 X.lambda$0 ()V\n" +
+ " constant #49 name_and_type: #22.#8 lambda$0 ()V\n" +
+ " constant #50 method handle: invokestatic (6) #48 \n" +
+ " constant #51 method type: #8 ()V\n" +
+ " constant #52 utf8: \"InnerClasses\"\n" +
+ " constant #53 class: #54 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #54 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #55 class: #56 java/lang/invoke/MethodHandles\n" +
+ " constant #56 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #57 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 Ljava/lang/Runnable;\n" +
" public java.lang.Runnable referenceExpression;\n" +
@@ -818,7 +786,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [10]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda$() : java.lang.Runnable [15]\n" +
+ " 5 invokedynamic 0 run() : java.lang.Runnable [15]\n" +
" 10 putfield X.referenceExpression : java.lang.Runnable [16]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -840,10 +808,10 @@
" [pc: 8, line: 3]\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #58 java/lang/invoke/MethodHandles$Lookup, outer class info: #60 java/lang/invoke/MethodHandles\n" +
- " inner name: #62 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #53 java/lang/invoke/MethodHandles$Lookup, outer class info: #55 java/lang/invoke/MethodHandles\n" +
+ " inner name: #57 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 45 arguments: {#52,#55,#56}\n" +
+ " 0 : # 45 arguments: {#47,#50,#51}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -880,10 +848,10 @@
" constant #9 utf8: \"Code\"\n" +
" constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
" constant #11 name_and_type: #7.#8 <init> ()V\n" +
- " constant #12 name_and_type: #13.#14 lambda$ ()Ljava/lang/Runnable;\n" +
- " constant #13 utf8: \"lambda$\"\n" +
+ " constant #12 name_and_type: #13.#14 run ()Ljava/lang/Runnable;\n" +
+ " constant #13 utf8: \"run\"\n" +
" constant #14 utf8: \"()Ljava/lang/Runnable;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda$ ()Ljava/lang/Runnable;\n" +
+ " constant #15 invoke dynamic: #0 #12 run ()Ljava/lang/Runnable;\n" +
" constant #16 field_ref: #1.#17 X.referenceExpression Ljava/lang/Runnable;\n" +
" constant #17 name_and_type: #5.#6 referenceExpression Ljava/lang/Runnable;\n" +
" constant #18 utf8: \"LineNumberTable\"\n" +
@@ -907,30 +875,25 @@
" constant #36 utf8: \"(Ljava/lang/String;)V\"\n" +
" constant #37 utf8: \"SourceFile\"\n" +
" constant #38 utf8: \"X.java\"\n" +
- " constant #39 method_ref: #40.#42 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #39 method_ref: #40.#42 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #40 class: #41 java/lang/invoke/LambdaMetafactory\n" +
" constant #41 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #42 name_and_type: #43.#44 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #43 utf8: \"metaFactory\"\n" +
- " constant #44 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #42 name_and_type: #43.#44 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #43 utf8: \"metafactory\"\n" +
+ " constant #44 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #45 method handle: invokestatic (6) #39 \n" +
" constant #46 utf8: \"BootstrapMethods\"\n" +
- " constant #47 interface_method_ref: #48.#50 java/lang/Runnable.run ()V\n" +
- " constant #48 class: #49 java/lang/Runnable\n" +
- " constant #49 utf8: \"java/lang/Runnable\"\n" +
- " constant #50 name_and_type: #51.#8 run ()V\n" +
- " constant #51 utf8: \"run\"\n" +
- " constant #52 method handle: invokeinterface (9) #47 \n" +
- " constant #53 method_ref: #1.#54 X.lambda$0 ()V\n" +
- " constant #54 name_and_type: #22.#8 lambda$0 ()V\n" +
- " constant #55 method handle: invokestatic (6) #53 \n" +
- " constant #56 method type: #8 ()V\n" +
- " constant #57 utf8: \"InnerClasses\"\n" +
- " constant #58 class: #59 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #59 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #60 class: #61 java/lang/invoke/MethodHandles\n" +
- " constant #61 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #62 utf8: \"Lookup\"\n" +
+ " constant #47 method type: #8 ()V\n" +
+ " constant #48 method_ref: #1.#49 X.lambda$0 ()V\n" +
+ " constant #49 name_and_type: #22.#8 lambda$0 ()V\n" +
+ " constant #50 method handle: invokestatic (6) #48 \n" +
+ " constant #51 method type: #8 ()V\n" +
+ " constant #52 utf8: \"InnerClasses\"\n" +
+ " constant #53 class: #54 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #54 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #55 class: #56 java/lang/invoke/MethodHandles\n" +
+ " constant #56 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #57 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 Ljava/lang/Runnable;\n" +
" public java.lang.Runnable referenceExpression;\n" +
@@ -941,7 +904,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [10]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda$() : java.lang.Runnable [15]\n" +
+ " 5 invokedynamic 0 run() : java.lang.Runnable [15]\n" +
" 10 putfield X.referenceExpression : java.lang.Runnable [16]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -962,12 +925,12 @@
" [pc: 0, line: 2]\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #58 java/lang/invoke/MethodHandles$Lookup, outer class info: #60 java/lang/invoke/MethodHandles\n" +
- " inner name: #62 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #53 java/lang/invoke/MethodHandles$Lookup, outer class info: #55 java/lang/invoke/MethodHandles\n" +
+ " inner name: #57 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 45 arguments: {#52,#55,#56}\n" +
+ " 0 : # 45 arguments: {#47,#50,#51}\n" +
"}";
-
+
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
}
public void test008() throws Exception {
@@ -1004,10 +967,10 @@
" constant #11 utf8: \"Code\"\n" +
" constant #12 method_ref: #3.#13 java/lang/Object.<init> ()V\n" +
" constant #13 name_and_type: #9.#10 <init> ()V\n" +
- " constant #14 name_and_type: #15.#16 lambda$ ()Ljava/util/function/Supplier;\n" +
- " constant #15 utf8: \"lambda$\"\n" +
+ " constant #14 name_and_type: #15.#16 get ()Ljava/util/function/Supplier;\n" +
+ " constant #15 utf8: \"get\"\n" +
" constant #16 utf8: \"()Ljava/util/function/Supplier;\"\n" +
- " constant #17 invoke dynamic: #0 #14 lambda$ ()Ljava/util/function/Supplier;\n" +
+ " constant #17 invoke dynamic: #0 #14 get ()Ljava/util/function/Supplier;\n" +
" constant #18 field_ref: #1.#19 X.lambda Ljava/util/function/Supplier;\n" +
" constant #19 name_and_type: #5.#6 lambda Ljava/util/function/Supplier;\n" +
" constant #20 utf8: \"LineNumberTable\"\n" +
@@ -1020,31 +983,26 @@
" constant #27 utf8: \"SUCCESS\"\n" +
" constant #28 utf8: \"SourceFile\"\n" +
" constant #29 utf8: \"X.java\"\n" +
- " constant #30 method_ref: #31.#33 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #30 method_ref: #31.#33 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #31 class: #32 java/lang/invoke/LambdaMetafactory\n" +
" constant #32 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #33 name_and_type: #34.#35 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #34 utf8: \"metaFactory\"\n" +
- " constant #35 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #33 name_and_type: #34.#35 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #34 utf8: \"metafactory\"\n" +
+ " constant #35 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #36 method handle: invokestatic (6) #30 \n" +
" constant #37 utf8: \"BootstrapMethods\"\n" +
- " constant #38 interface_method_ref: #39.#41 java/util/function/Supplier.get ()Ljava/lang/Object;\n" +
- " constant #39 class: #40 java/util/function/Supplier\n" +
- " constant #40 utf8: \"java/util/function/Supplier\"\n" +
- " constant #41 name_and_type: #42.#43 get ()Ljava/lang/Object;\n" +
- " constant #42 utf8: \"get\"\n" +
- " constant #43 utf8: \"()Ljava/lang/Object;\"\n" +
- " constant #44 method handle: invokeinterface (9) #38 \n" +
- " constant #45 method_ref: #1.#46 X.lambda$0 ()Ljava/lang/String;\n" +
- " constant #46 name_and_type: #24.#25 lambda$0 ()Ljava/lang/String;\n" +
- " constant #47 method handle: invokestatic (6) #45 \n" +
- " constant #48 method type: #25 ()Ljava/lang/String;\n" +
- " constant #49 utf8: \"InnerClasses\"\n" +
- " constant #50 class: #51 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #51 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #52 class: #53 java/lang/invoke/MethodHandles\n" +
- " constant #53 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #54 utf8: \"Lookup\"\n" +
+ " constant #38 utf8: \"()Ljava/lang/Object;\"\n" +
+ " constant #39 method type: #38 ()Ljava/lang/Object;\n" +
+ " constant #40 method_ref: #1.#41 X.lambda$0 ()Ljava/lang/String;\n" +
+ " constant #41 name_and_type: #24.#25 lambda$0 ()Ljava/lang/String;\n" +
+ " constant #42 method handle: invokestatic (6) #40 \n" +
+ " constant #43 method type: #25 ()Ljava/lang/String;\n" +
+ " constant #44 utf8: \"InnerClasses\"\n" +
+ " constant #45 class: #46 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #46 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #47 class: #48 java/lang/invoke/MethodHandles\n" +
+ " constant #48 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #49 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 Ljava/util/function/Supplier;\n" +
" // Signature: Ljava/util/function/Supplier<Ljava/lang/String;>;\n" +
@@ -1056,7 +1014,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [12]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda$() : java.util.function.Supplier [17]\n" +
+ " 5 invokedynamic 0 get() : java.util.function.Supplier [17]\n" +
" 10 putfield X.lambda : java.util.function.Supplier [18]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -1075,11 +1033,12 @@
" [pc: 0, line: 2]\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #50 java/lang/invoke/MethodHandles$Lookup, outer class info: #52 java/lang/invoke/MethodHandles\n" +
- " inner name: #54 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #45 java/lang/invoke/MethodHandles$Lookup, outer class info: #47 java/lang/invoke/MethodHandles\n" +
+ " inner name: #49 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 36 arguments: {#44,#47,#48}\n" +
- "}";
+ " 0 : # 36 arguments: {#39,#42,#43}\n" +
+ "}"
+;
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
}
@@ -1122,10 +1081,10 @@
" constant #11 utf8: \"Code\"\n" +
" constant #12 method_ref: #3.#13 java/lang/Object.<init> ()V\n" +
" constant #13 name_and_type: #9.#10 <init> ()V\n" +
- " constant #14 name_and_type: #15.#16 lambda$ ()LFunction2;\n" +
- " constant #15 utf8: \"lambda$\"\n" +
+ " constant #14 name_and_type: #15.#16 apply ()LFunction2;\n" +
+ " constant #15 utf8: \"apply\"\n" +
" constant #16 utf8: \"()LFunction2;\"\n" +
- " constant #17 invoke dynamic: #0 #14 lambda$ ()LFunction2;\n" +
+ " constant #17 invoke dynamic: #0 #14 apply ()LFunction2;\n" +
" constant #18 field_ref: #1.#19 X.concat LFunction2;\n" +
" constant #19 name_and_type: #5.#6 concat LFunction2;\n" +
" constant #20 utf8: \"LineNumberTable\"\n" +
@@ -1158,31 +1117,26 @@
" constant #47 utf8: \"s2\"\n" +
" constant #48 utf8: \"SourceFile\"\n" +
" constant #49 utf8: \"X.java\"\n" +
- " constant #50 method_ref: #51.#53 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #50 method_ref: #51.#53 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #51 class: #52 java/lang/invoke/LambdaMetafactory\n" +
" constant #52 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #53 name_and_type: #54.#55 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #54 utf8: \"metaFactory\"\n" +
- " constant #55 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #53 name_and_type: #54.#55 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #54 utf8: \"metafactory\"\n" +
+ " constant #55 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #56 method handle: invokestatic (6) #50 \n" +
" constant #57 utf8: \"BootstrapMethods\"\n" +
- " constant #58 interface_method_ref: #59.#61 Function2.apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #59 class: #60 Function2\n" +
- " constant #60 utf8: \"Function2\"\n" +
- " constant #61 name_and_type: #62.#63 apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #62 utf8: \"apply\"\n" +
- " constant #63 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
- " constant #64 method handle: invokeinterface (9) #58 \n" +
- " constant #65 method_ref: #1.#66 X.lambda$0 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #66 name_and_type: #24.#25 lambda$0 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #67 method handle: invokestatic (6) #65 \n" +
- " constant #68 method type: #25 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #69 utf8: \"InnerClasses\"\n" +
- " constant #70 class: #71 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #71 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #72 class: #73 java/lang/invoke/MethodHandles\n" +
- " constant #73 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #74 utf8: \"Lookup\"\n" +
+ " constant #58 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
+ " constant #59 method type: #58 (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
+ " constant #60 method_ref: #1.#61 X.lambda$0 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #61 name_and_type: #24.#25 lambda$0 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #62 method handle: invokestatic (6) #60 \n" +
+ " constant #63 method type: #25 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #64 utf8: \"InnerClasses\"\n" +
+ " constant #65 class: #66 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #66 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #67 class: #68 java/lang/invoke/MethodHandles\n" +
+ " constant #68 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #69 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LFunction2;\n" +
" // Signature: LFunction2<Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;>;\n" +
@@ -1194,7 +1148,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [12]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda$() : Function2 [17]\n" +
+ " 5 invokedynamic 0 apply() : Function2 [17]\n" +
" 10 putfield X.concat : Function2 [18]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -1223,10 +1177,10 @@
" [pc: 0, pc: 19] local: s2 index: 1 type: java.lang.String\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #70 java/lang/invoke/MethodHandles$Lookup, outer class info: #72 java/lang/invoke/MethodHandles\n" +
- " inner name: #74 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #65 java/lang/invoke/MethodHandles$Lookup, outer class info: #67 java/lang/invoke/MethodHandles\n" +
+ " inner name: #69 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 56 arguments: {#64,#67,#68}\n" +
+ " 0 : # 56 arguments: {#59,#62,#63}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -1281,10 +1235,10 @@
" constant #18 method_ref: #14.#19 java/lang/String.<init> (Ljava/lang/String;)V\n" +
" constant #19 name_and_type: #9.#20 <init> (Ljava/lang/String;)V\n" +
" constant #20 utf8: \"(Ljava/lang/String;)V\"\n" +
- " constant #21 name_and_type: #22.#23 lambda$ (Ljava/lang/String;)LFunction2;\n" +
- " constant #22 utf8: \"lambda$\"\n" +
+ " constant #21 name_and_type: #22.#23 apply (Ljava/lang/String;)LFunction2;\n" +
+ " constant #22 utf8: \"apply\"\n" +
" constant #23 utf8: \"(Ljava/lang/String;)LFunction2;\"\n" +
- " constant #24 invoke dynamic: #0 #21 lambda$ (Ljava/lang/String;)LFunction2;\n" +
+ " constant #24 invoke dynamic: #0 #21 apply (Ljava/lang/String;)LFunction2;\n" +
" constant #25 field_ref: #1.#26 X.concat LFunction2;\n" +
" constant #26 name_and_type: #5.#6 concat LFunction2;\n" +
" constant #27 utf8: \"LineNumberTable\"\n" +
@@ -1314,32 +1268,27 @@
" constant #51 utf8: \"s2\"\n" +
" constant #52 utf8: \"SourceFile\"\n" +
" constant #53 utf8: \"X.java\"\n" +
- " constant #54 method_ref: #55.#57 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #54 method_ref: #55.#57 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #55 class: #56 java/lang/invoke/LambdaMetafactory\n" +
" constant #56 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #57 name_and_type: #58.#59 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #58 utf8: \"metaFactory\"\n" +
- " constant #59 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #57 name_and_type: #58.#59 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #58 utf8: \"metafactory\"\n" +
+ " constant #59 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #60 method handle: invokestatic (6) #54 \n" +
" constant #61 utf8: \"BootstrapMethods\"\n" +
- " constant #62 interface_method_ref: #63.#65 Function2.apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #63 class: #64 Function2\n" +
- " constant #64 utf8: \"Function2\"\n" +
- " constant #65 name_and_type: #66.#67 apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #66 utf8: \"apply\"\n" +
- " constant #67 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
- " constant #68 method handle: invokeinterface (9) #62 \n" +
- " constant #69 method_ref: #1.#70 X.lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #70 name_and_type: #33.#34 lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #71 method handle: invokestatic (6) #69 \n" +
- " constant #72 utf8: \"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\"\n" +
- " constant #73 method type: #72 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #74 utf8: \"InnerClasses\"\n" +
- " constant #75 class: #76 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #76 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #77 class: #78 java/lang/invoke/MethodHandles\n" +
- " constant #78 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #79 utf8: \"Lookup\"\n" +
+ " constant #62 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
+ " constant #63 method type: #62 (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
+ " constant #64 method_ref: #1.#65 X.lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #65 name_and_type: #33.#34 lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #66 method handle: invokestatic (6) #64 \n" +
+ " constant #67 utf8: \"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\"\n" +
+ " constant #68 method type: #67 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #69 utf8: \"InnerClasses\"\n" +
+ " constant #70 class: #71 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #71 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #72 class: #73 java/lang/invoke/MethodHandles\n" +
+ " constant #73 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #74 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LFunction2;\n" +
" // Signature: LFunction2<Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;>;\n" +
@@ -1357,7 +1306,7 @@
" 13 astore_1 [s0]\n" +
" 14 aload_0 [this]\n" +
" 15 aload_1 [s0]\n" +
- " 16 invokedynamic 0 lambda$(java.lang.String) : Function2 [24]\n" +
+ " 16 invokedynamic 0 apply(java.lang.String) : Function2 [24]\n" +
" 21 putfield X.concat : Function2 [25]\n" +
" 24 return\n" +
" Line numbers:\n" +
@@ -1390,11 +1339,12 @@
" [pc: 0, pc: 23] local: s2 index: 2 type: java.lang.String\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #75 java/lang/invoke/MethodHandles$Lookup, outer class info: #77 java/lang/invoke/MethodHandles\n" +
- " inner name: #79 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #70 java/lang/invoke/MethodHandles$Lookup, outer class info: #72 java/lang/invoke/MethodHandles\n" +
+ " inner name: #74 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 60 arguments: {#68,#71,#73}\n" +
- "}";
+ " 0 : # 60 arguments: {#63,#66,#68}\n" +
+ "}"
+;
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
}
@@ -1448,10 +1398,10 @@
" constant #18 method_ref: #14.#19 java/lang/String.<init> (Ljava/lang/String;)V\n" +
" constant #19 name_and_type: #9.#20 <init> (Ljava/lang/String;)V\n" +
" constant #20 utf8: \"(Ljava/lang/String;)V\"\n" +
- " constant #21 name_and_type: #22.#23 lambda$ (Ljava/lang/String;)LFunction2;\n" +
- " constant #22 utf8: \"lambda$\"\n" +
+ " constant #21 name_and_type: #22.#23 apply (Ljava/lang/String;)LFunction2;\n" +
+ " constant #22 utf8: \"apply\"\n" +
" constant #23 utf8: \"(Ljava/lang/String;)LFunction2;\"\n" +
- " constant #24 invoke dynamic: #0 #21 lambda$ (Ljava/lang/String;)LFunction2;\n" +
+ " constant #24 invoke dynamic: #0 #21 apply (Ljava/lang/String;)LFunction2;\n" +
" constant #25 field_ref: #1.#26 X.concat LFunction2;\n" +
" constant #26 name_and_type: #5.#6 concat LFunction2;\n" +
" constant #27 utf8: \"LineNumberTable\"\n" +
@@ -1481,32 +1431,27 @@
" constant #51 utf8: \"s2\"\n" +
" constant #52 utf8: \"SourceFile\"\n" +
" constant #53 utf8: \"X.java\"\n" +
- " constant #54 method_ref: #55.#57 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #54 method_ref: #55.#57 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #55 class: #56 java/lang/invoke/LambdaMetafactory\n" +
" constant #56 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #57 name_and_type: #58.#59 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #58 utf8: \"metaFactory\"\n" +
- " constant #59 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #57 name_and_type: #58.#59 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #58 utf8: \"metafactory\"\n" +
+ " constant #59 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #60 method handle: invokestatic (6) #54 \n" +
" constant #61 utf8: \"BootstrapMethods\"\n" +
- " constant #62 interface_method_ref: #63.#65 Function2.apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #63 class: #64 Function2\n" +
- " constant #64 utf8: \"Function2\"\n" +
- " constant #65 name_and_type: #66.#67 apply (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
- " constant #66 utf8: \"apply\"\n" +
- " constant #67 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
- " constant #68 method handle: invokeinterface (9) #62 \n" +
- " constant #69 method_ref: #1.#70 X.lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #70 name_and_type: #33.#34 lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #71 method handle: invokestatic (6) #69 \n" +
- " constant #72 utf8: \"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\"\n" +
- " constant #73 method type: #72 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
- " constant #74 utf8: \"InnerClasses\"\n" +
- " constant #75 class: #76 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #76 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #77 class: #78 java/lang/invoke/MethodHandles\n" +
- " constant #78 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #79 utf8: \"Lookup\"\n" +
+ " constant #62 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\"\n" +
+ " constant #63 method type: #62 (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;\n" +
+ " constant #64 method_ref: #1.#65 X.lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #65 name_and_type: #33.#34 lambda$0 (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #66 method handle: invokestatic (6) #64 \n" +
+ " constant #67 utf8: \"(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\"\n" +
+ " constant #68 method type: #67 (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;\n" +
+ " constant #69 utf8: \"InnerClasses\"\n" +
+ " constant #70 class: #71 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #71 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #72 class: #73 java/lang/invoke/MethodHandles\n" +
+ " constant #73 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #74 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LFunction2;\n" +
" // Signature: LFunction2<Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;>;\n" +
@@ -1524,7 +1469,7 @@
" 13 astore_1 [s0]\n" +
" 14 aload_0 [this]\n" +
" 15 aload_1 [s0]\n" +
- " 16 invokedynamic 0 lambda$(java.lang.String) : Function2 [24]\n" +
+ " 16 invokedynamic 0 apply(java.lang.String) : Function2 [24]\n" +
" 21 putfield X.concat : Function2 [25]\n" +
" 24 return\n" +
" Line numbers:\n" +
@@ -1557,10 +1502,10 @@
" [pc: 0, pc: 23] local: s2 index: 2 type: java.lang.String\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #75 java/lang/invoke/MethodHandles$Lookup, outer class info: #77 java/lang/invoke/MethodHandles\n" +
- " inner name: #79 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #70 java/lang/invoke/MethodHandles$Lookup, outer class info: #72 java/lang/invoke/MethodHandles\n" +
+ " inner name: #74 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 60 arguments: {#68,#71,#73}\n" +
+ " 0 : # 60 arguments: {#63,#66,#68}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -1611,10 +1556,10 @@
" constant #13 utf8: \"LX;\"\n" +
" constant #14 utf8: \"main\"\n" +
" constant #15 utf8: \"([Ljava/lang/String;)V\"\n" +
- " constant #16 name_and_type: #17.#18 lambda$ ([Ljava/lang/String;II)LI;\n" +
- " constant #17 utf8: \"lambda$\"\n" +
+ " constant #16 name_and_type: #17.#18 doit ([Ljava/lang/String;II)LI;\n" +
+ " constant #17 utf8: \"doit\"\n" +
" constant #18 utf8: \"([Ljava/lang/String;II)LI;\"\n" +
- " constant #19 invoke dynamic: #0 #16 lambda$ ([Ljava/lang/String;II)LI;\n" +
+ " constant #19 invoke dynamic: #0 #16 doit ([Ljava/lang/String;II)LI;\n" +
" constant #20 utf8: \"args\"\n" +
" constant #21 utf8: \"[Ljava/lang/String;\"\n" +
" constant #22 utf8: \"local1\"\n" +
@@ -1631,30 +1576,26 @@
" constant #33 utf8: \"p\"\n" +
" constant #34 utf8: \"SourceFile\"\n" +
" constant #35 utf8: \"X.java\"\n" +
- " constant #36 method_ref: #37.#39 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #36 method_ref: #37.#39 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #37 class: #38 java/lang/invoke/LambdaMetafactory\n" +
" constant #38 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #39 name_and_type: #40.#41 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #40 utf8: \"metaFactory\"\n" +
- " constant #41 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #39 name_and_type: #40.#41 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #40 utf8: \"metafactory\"\n" +
+ " constant #41 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #42 method handle: invokestatic (6) #36 \n" +
" constant #43 utf8: \"BootstrapMethods\"\n" +
- " constant #44 interface_method_ref: #45.#46 I.doit (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #45 class: #23 I\n" +
- " constant #46 name_and_type: #47.#48 doit (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #47 utf8: \"doit\"\n" +
- " constant #48 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)V\"\n" +
- " constant #49 method handle: invokeinterface (9) #44 \n" +
- " constant #50 method_ref: #1.#51 X.lambda$0 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #51 name_and_type: #27.#28 lambda$0 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #52 method handle: invokestatic (6) #50 \n" +
- " constant #53 method type: #48 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #54 utf8: \"InnerClasses\"\n" +
- " constant #55 class: #56 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #56 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #57 class: #58 java/lang/invoke/MethodHandles\n" +
- " constant #58 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #59 utf8: \"Lookup\"\n" +
+ " constant #44 utf8: \"(Ljava/lang/Object;Ljava/lang/Object;)V\"\n" +
+ " constant #45 method type: #44 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #46 method_ref: #1.#47 X.lambda$0 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #47 name_and_type: #27.#28 lambda$0 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #48 method handle: invokestatic (6) #46 \n" +
+ " constant #49 method type: #44 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #50 utf8: \"InnerClasses\"\n" +
+ " constant #51 class: #52 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #52 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #53 class: #54 java/lang/invoke/MethodHandles\n" +
+ " constant #54 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #55 utf8: \"Lookup\"\n" +
" \n" +
" // Method descriptor #6 ()V\n" +
" // Stack: 1, Locals: 1\n" +
@@ -1677,7 +1618,7 @@
" 4 aload_0 [args]\n" +
" 5 iload_1 [local1]\n" +
" 6 iload_2 [local2]\n" +
- " 7 invokedynamic 0 lambda$(java.lang.String[], int, int) : I [19]\n" +
+ " 7 invokedynamic 0 doit(java.lang.String[], int, int) : I [19]\n" +
" 12 astore_3 [i]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -1719,11 +1660,12 @@
" )\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #55 java/lang/invoke/MethodHandles$Lookup, outer class info: #57 java/lang/invoke/MethodHandles\n" +
- " inner name: #59 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #51 java/lang/invoke/MethodHandles$Lookup, outer class info: #53 java/lang/invoke/MethodHandles\n" +
+ " inner name: #55 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 42 arguments: {#49,#52,#53}\n" +
- "}";
+ " 0 : # 42 arguments: {#45,#48,#49}\n" +
+ "}"
+;
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
}
@@ -1771,10 +1713,10 @@
" constant #13 utf8: \"LX;\"\n" +
" constant #14 utf8: \"main\"\n" +
" constant #15 utf8: \"([Ljava/lang/String;)V\"\n" +
- " constant #16 name_and_type: #17.#18 lambda$ ()LI;\n" +
- " constant #17 utf8: \"lambda$\"\n" +
+ " constant #16 name_and_type: #17.#18 doit ()LI;\n" +
+ " constant #17 utf8: \"doit\"\n" +
" constant #18 utf8: \"()LI;\"\n" +
- " constant #19 invoke dynamic: #0 #16 lambda$ ()LI;\n" +
+ " constant #19 invoke dynamic: #0 #16 doit ()LI;\n" +
" constant #20 utf8: \"args\"\n" +
" constant #21 utf8: \"[Ljava/lang/String;\"\n" +
" constant #22 utf8: \"i\"\n" +
@@ -1788,30 +1730,25 @@
" constant #30 utf8: \"p\"\n" +
" constant #31 utf8: \"SourceFile\"\n" +
" constant #32 utf8: \"X.java\"\n" +
- " constant #33 method_ref: #34.#36 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #33 method_ref: #34.#36 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #34 class: #35 java/lang/invoke/LambdaMetafactory\n" +
" constant #35 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #36 name_and_type: #37.#38 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #37 utf8: \"metaFactory\"\n" +
- " constant #38 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #36 name_and_type: #37.#38 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #37 utf8: \"metafactory\"\n" +
+ " constant #38 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #39 method handle: invokestatic (6) #33 \n" +
" constant #40 utf8: \"BootstrapMethods\"\n" +
- " constant #41 interface_method_ref: #42.#44 I.doit (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #42 class: #43 I\n" +
- " constant #43 utf8: \"I\"\n" +
- " constant #44 name_and_type: #45.#25 doit (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #45 utf8: \"doit\"\n" +
- " constant #46 method handle: invokeinterface (9) #41 \n" +
- " constant #47 method_ref: #1.#48 X.lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #48 name_and_type: #24.#25 lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #49 method handle: invokestatic (6) #47 \n" +
- " constant #50 method type: #25 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #51 utf8: \"InnerClasses\"\n" +
- " constant #52 class: #53 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #53 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #54 class: #55 java/lang/invoke/MethodHandles\n" +
- " constant #55 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #56 utf8: \"Lookup\"\n" +
+ " constant #41 method type: #25 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #42 method_ref: #1.#43 X.lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #43 name_and_type: #24.#25 lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #44 method handle: invokestatic (6) #42 \n" +
+ " constant #45 method type: #25 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #46 utf8: \"InnerClasses\"\n" +
+ " constant #47 class: #48 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #48 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #49 class: #50 java/lang/invoke/MethodHandles\n" +
+ " constant #50 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #51 utf8: \"Lookup\"\n" +
" \n" +
" // Method descriptor #6 ()V\n" +
" // Stack: 1, Locals: 1\n" +
@@ -1827,7 +1764,7 @@
" // Method descriptor #15 ([Ljava/lang/String;)V\n" +
" // Stack: 1, Locals: 2\n" +
" public static void main(java.lang.String[] args);\n" +
- " 0 invokedynamic 0 lambda$() : I [19]\n" +
+ " 0 invokedynamic 0 doit() : I [19]\n" +
" 5 astore_1 [i]\n" +
" 6 return\n" +
" Line numbers:\n" +
@@ -1855,10 +1792,10 @@
" )\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #52 java/lang/invoke/MethodHandles$Lookup, outer class info: #54 java/lang/invoke/MethodHandles\n" +
- " inner name: #56 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #47 java/lang/invoke/MethodHandles$Lookup, outer class info: #49 java/lang/invoke/MethodHandles\n" +
+ " inner name: #51 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 39 arguments: {#46,#49,#50}\n" +
+ " 0 : # 39 arguments: {#41,#44,#45}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -1906,10 +1843,10 @@
" constant #9 utf8: \"Code\"\n" +
" constant #10 method_ref: #3.#11 java/lang/Object.<init> ()V\n" +
" constant #11 name_and_type: #7.#8 <init> ()V\n" +
- " constant #12 name_and_type: #13.#14 lambda$ ()LI;\n" +
- " constant #13 utf8: \"lambda$\"\n" +
+ " constant #12 name_and_type: #13.#14 doit ()LI;\n" +
+ " constant #13 utf8: \"doit\"\n" +
" constant #14 utf8: \"()LI;\"\n" +
- " constant #15 invoke dynamic: #0 #12 lambda$ ()LI;\n" +
+ " constant #15 invoke dynamic: #0 #12 doit ()LI;\n" +
" constant #16 field_ref: #1.#17 X.i LI;\n" +
" constant #17 name_and_type: #5.#6 i LI;\n" +
" constant #18 utf8: \"LineNumberTable\"\n" +
@@ -1918,9 +1855,9 @@
" constant #21 utf8: \"LX;\"\n" +
" constant #22 utf8: \"main\"\n" +
" constant #23 utf8: \"([Ljava/lang/String;)V\"\n" +
- " constant #24 name_and_type: #13.#25 lambda$ ([Ljava/lang/String;II)LI;\n" +
+ " constant #24 name_and_type: #13.#25 doit ([Ljava/lang/String;II)LI;\n" +
" constant #25 utf8: \"([Ljava/lang/String;II)LI;\"\n" +
- " constant #26 invoke dynamic: #1 #24 lambda$ ([Ljava/lang/String;II)LI;\n" +
+ " constant #26 invoke dynamic: #1 #24 doit ([Ljava/lang/String;II)LI;\n" +
" constant #27 utf8: \"args\"\n" +
" constant #28 utf8: \"[Ljava/lang/String;\"\n" +
" constant #29 utf8: \"local1\"\n" +
@@ -1937,34 +1874,30 @@
" constant #40 utf8: \"([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\"\n" +
" constant #41 utf8: \"SourceFile\"\n" +
" constant #42 utf8: \"X.java\"\n" +
- " constant #43 method_ref: #44.#46 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #43 method_ref: #44.#46 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #44 class: #45 java/lang/invoke/LambdaMetafactory\n" +
" constant #45 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #46 name_and_type: #47.#48 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #47 utf8: \"metaFactory\"\n" +
- " constant #48 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #46 name_and_type: #47.#48 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #47 utf8: \"metafactory\"\n" +
+ " constant #48 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #49 method handle: invokestatic (6) #43 \n" +
" constant #50 utf8: \"BootstrapMethods\"\n" +
- " constant #51 interface_method_ref: #52.#53 I.doit (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #52 class: #30 I\n" +
- " constant #53 name_and_type: #54.#33 doit (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #54 utf8: \"doit\"\n" +
- " constant #55 method handle: invokeinterface (9) #51 \n" +
- " constant #56 method_ref: #1.#57 X.lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #57 name_and_type: #32.#33 lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #58 method handle: invokestatic (6) #56 \n" +
- " constant #59 method type: #33 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #60 method handle: invokeinterface (9) #51 \n" +
- " constant #61 method_ref: #1.#62 X.lambda$1 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #62 name_and_type: #39.#40 lambda$1 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #63 method handle: invokestatic (6) #61 \n" +
- " constant #64 method type: #33 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
- " constant #65 utf8: \"InnerClasses\"\n" +
- " constant #66 class: #67 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #67 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #68 class: #69 java/lang/invoke/MethodHandles\n" +
- " constant #69 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #70 utf8: \"Lookup\"\n" +
+ " constant #51 method type: #33 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #52 method_ref: #1.#53 X.lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #53 name_and_type: #32.#33 lambda$0 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #54 method handle: invokestatic (6) #52 \n" +
+ " constant #55 method type: #33 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #56 method type: #33 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #57 method_ref: #1.#58 X.lambda$1 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #58 name_and_type: #39.#40 lambda$1 ([Ljava/lang/String;IILjava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #59 method handle: invokestatic (6) #57 \n" +
+ " constant #60 method type: #33 (Ljava/lang/Object;Ljava/lang/Object;)V\n" +
+ " constant #61 utf8: \"InnerClasses\"\n" +
+ " constant #62 class: #63 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #63 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #64 class: #65 java/lang/invoke/MethodHandles\n" +
+ " constant #65 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #66 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LI;\n" +
" I i;\n" +
@@ -1975,7 +1908,7 @@
" 0 aload_0 [this]\n" +
" 1 invokespecial java.lang.Object() [10]\n" +
" 4 aload_0 [this]\n" +
- " 5 invokedynamic 0 lambda$() : I [15]\n" +
+ " 5 invokedynamic 0 doit() : I [15]\n" +
" 10 putfield X.i : I [16]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -1995,7 +1928,7 @@
" 4 aload_0 [args]\n" +
" 5 iload_1 [local1]\n" +
" 6 iload_2 [local2]\n" +
- " 7 invokedynamic 1 lambda$(java.lang.String[], int, int) : I [26]\n" +
+ " 7 invokedynamic 1 doit(java.lang.String[], int, int) : I [26]\n" +
" 12 astore_3 [i]\n" +
" 13 return\n" +
" Line numbers:\n" +
@@ -2054,11 +1987,11 @@
" )\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #66 java/lang/invoke/MethodHandles$Lookup, outer class info: #68 java/lang/invoke/MethodHandles\n" +
- " inner name: #70 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #62 java/lang/invoke/MethodHandles$Lookup, outer class info: #64 java/lang/invoke/MethodHandles\n" +
+ " inner name: #66 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 49 arguments: {#55,#58,#59},\n" +
- " 1 : # 49 arguments: {#60,#63,#64}\n" +
+ " 0 : # 49 arguments: {#51,#54,#55},\n" +
+ " 1 : # 49 arguments: {#56,#59,#60}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -2098,10 +2031,10 @@
" constant #13 utf8: \"LX;\"\n" +
" constant #14 utf8: \"main\"\n" +
" constant #15 utf8: \"([Ljava/lang/String;)V\"\n" +
- " constant #16 name_and_type: #17.#18 lambda$ ()LI;\n" +
- " constant #17 utf8: \"lambda$\"\n" +
+ " constant #16 name_and_type: #17.#18 foo ()LI;\n" +
+ " constant #17 utf8: \"foo\"\n" +
" constant #18 utf8: \"()LI;\"\n" +
- " constant #19 invoke dynamic: #0 #16 lambda$ ()LI;\n" +
+ " constant #19 invoke dynamic: #0 #16 foo ()LI;\n" +
" constant #20 utf8: \"args\"\n" +
" constant #21 utf8: \"[Ljava/lang/String;\"\n" +
" constant #22 utf8: \"i\"\n" +
@@ -2109,30 +2042,25 @@
" constant #24 utf8: \"lambda$0\"\n" +
" constant #25 utf8: \"SourceFile\"\n" +
" constant #26 utf8: \"X.java\"\n" +
- " constant #27 method_ref: #28.#30 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #27 method_ref: #28.#30 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
" constant #28 class: #29 java/lang/invoke/LambdaMetafactory\n" +
" constant #29 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #30 name_and_type: #31.#32 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #31 utf8: \"metaFactory\"\n" +
- " constant #32 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #30 name_and_type: #31.#32 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #31 utf8: \"metafactory\"\n" +
+ " constant #32 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
" constant #33 method handle: invokestatic (6) #27 \n" +
" constant #34 utf8: \"BootstrapMethods\"\n" +
- " constant #35 interface_method_ref: #36.#38 I.foo ()V\n" +
- " constant #36 class: #37 I\n" +
- " constant #37 utf8: \"I\"\n" +
- " constant #38 name_and_type: #39.#6 foo ()V\n" +
- " constant #39 utf8: \"foo\"\n" +
- " constant #40 method handle: invokeinterface (9) #35 \n" +
- " constant #41 method_ref: #1.#42 X.lambda$0 ()V\n" +
- " constant #42 name_and_type: #24.#6 lambda$0 ()V\n" +
- " constant #43 method handle: invokestatic (6) #41 \n" +
- " constant #44 method type: #6 ()V\n" +
- " constant #45 utf8: \"InnerClasses\"\n" +
- " constant #46 class: #47 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #47 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #48 class: #49 java/lang/invoke/MethodHandles\n" +
- " constant #49 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #50 utf8: \"Lookup\"\n" +
+ " constant #35 method type: #6 ()V\n" +
+ " constant #36 method_ref: #1.#37 X.lambda$0 ()V\n" +
+ " constant #37 name_and_type: #24.#6 lambda$0 ()V\n" +
+ " constant #38 method handle: invokestatic (6) #36 \n" +
+ " constant #39 method type: #6 ()V\n" +
+ " constant #40 utf8: \"InnerClasses\"\n" +
+ " constant #41 class: #42 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #42 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #43 class: #44 java/lang/invoke/MethodHandles\n" +
+ " constant #44 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #45 utf8: \"Lookup\"\n" +
" \n" +
" // Method descriptor #6 ()V\n" +
" // Stack: 1, Locals: 1\n" +
@@ -2148,7 +2076,7 @@
" // Method descriptor #15 ([Ljava/lang/String;)V\n" +
" // Stack: 1, Locals: 2\n" +
" public static void main(java.lang.String[] args);\n" +
- " 0 invokedynamic 0 lambda$() : I [19]\n" +
+ " 0 invokedynamic 0 foo() : I [19]\n" +
" 5 astore_1 [i]\n" +
" 6 return\n" +
" Line numbers:\n" +
@@ -2166,10 +2094,10 @@
" [pc: 0, line: 6]\n" +
"\n" +
" Inner classes:\n" +
- " [inner class info: #46 java/lang/invoke/MethodHandles$Lookup, outer class info: #48 java/lang/invoke/MethodHandles\n" +
- " inner name: #50 Lookup, accessflags: 25 public static final]\n" +
+ " [inner class info: #41 java/lang/invoke/MethodHandles$Lookup, outer class info: #43 java/lang/invoke/MethodHandles\n" +
+ " inner name: #45 Lookup, accessflags: 25 public static final]\n" +
"Bootstrap methods:\n" +
- " 0 : # 33 arguments: {#40,#43,#44}\n" +
+ " 0 : # 33 arguments: {#35,#38,#39}\n" +
"}";
verifyClassFile(expectedOutput, "X.class", ClassFileBytesDisassembler.SYSTEM);
@@ -2229,61 +2157,60 @@
" constant #20 utf8: \"()Ljava/lang/Object;\"\n" +
" constant #21 utf8: \"Signature\"\n" +
" constant #22 utf8: \"()TT;\"\n" +
- " constant #23 name_and_type: #24.#25 lambda$ ()LI;\n" +
- " constant #24 utf8: \"lambda$\"\n" +
+ " constant #23 name_and_type: #24.#25 doit ()LI;\n" +
+ " constant #24 utf8: \"doit\"\n" +
" constant #25 utf8: \"()LI;\"\n" +
- " constant #26 invoke dynamic: #0 #23 lambda$ ()LI;\n" +
+ " constant #26 invoke dynamic: #0 #23 doit ()LI;\n" +
" constant #27 interface_method_ref: #28.#30 I.doit ()V\n" +
" constant #28 class: #29 I\n" +
" constant #29 utf8: \"I\"\n" +
- " constant #30 name_and_type: #31.#14 doit ()V\n" +
- " constant #31 utf8: \"doit\"\n" +
- " constant #32 utf8: \"lambda$0\"\n" +
- " constant #33 field_ref: #34.#36 java/lang/System.out Ljava/io/PrintStream;\n" +
- " constant #34 class: #35 java/lang/System\n" +
- " constant #35 utf8: \"java/lang/System\"\n" +
- " constant #36 name_and_type: #37.#38 out Ljava/io/PrintStream;\n" +
- " constant #37 utf8: \"out\"\n" +
- " constant #38 utf8: \"Ljava/io/PrintStream;\"\n" +
- " constant #39 string: #40 \"Lambda\"\n" +
- " constant #40 utf8: \"Lambda\"\n" +
- " constant #41 method_ref: #42.#44 java/io/PrintStream.println (Ljava/lang/String;)V\n" +
- " constant #42 class: #43 java/io/PrintStream\n" +
- " constant #43 utf8: \"java/io/PrintStream\"\n" +
- " constant #44 name_and_type: #45.#46 println (Ljava/lang/String;)V\n" +
- " constant #45 utf8: \"println\"\n" +
- " constant #46 utf8: \"(Ljava/lang/String;)V\"\n" +
- " constant #47 utf8: \"t\"\n" +
- " constant #48 utf8: \"Ljava/lang/Object;\"\n" +
- " constant #49 utf8: \"LocalVariableTypeTable\"\n" +
- " constant #50 utf8: \"TT;\"\n" +
- " constant #51 utf8: \"SourceFile\"\n" +
- " constant #52 utf8: \"X.java\"\n" +
- " constant #53 utf8: \"EnclosingMethod\"\n" +
- " constant #54 class: #55 X\n" +
- " constant #55 utf8: \"X\"\n" +
- " constant #56 name_and_type: #57.#14 foo ()V\n" +
- " constant #57 utf8: \"foo\"\n" +
- " constant #58 method_ref: #59.#61 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #59 class: #60 java/lang/invoke/LambdaMetafactory\n" +
- " constant #60 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #61 name_and_type: #62.#63 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #62 utf8: \"metaFactory\"\n" +
- " constant #63 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
- " constant #64 method handle: invokestatic (6) #58 \n" +
- " constant #65 utf8: \"BootstrapMethods\"\n" +
- " constant #66 method handle: invokeinterface (9) #27 \n" +
- " constant #67 method_ref: #1.#68 X$1Y.lambda$0 ()V\n" +
- " constant #68 name_and_type: #32.#14 lambda$0 ()V\n" +
- " constant #69 method handle: invokestatic (6) #67 \n" +
- " constant #70 method type: #14 ()V\n" +
- " constant #71 utf8: \"InnerClasses\"\n" +
- " constant #72 utf8: \"Y\"\n" +
- " constant #73 class: #74 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #74 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #75 class: #76 java/lang/invoke/MethodHandles\n" +
- " constant #76 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #77 utf8: \"Lookup\"\n" +
+ " constant #30 name_and_type: #24.#14 doit ()V\n" +
+ " constant #31 utf8: \"lambda$0\"\n" +
+ " constant #32 field_ref: #33.#35 java/lang/System.out Ljava/io/PrintStream;\n" +
+ " constant #33 class: #34 java/lang/System\n" +
+ " constant #34 utf8: \"java/lang/System\"\n" +
+ " constant #35 name_and_type: #36.#37 out Ljava/io/PrintStream;\n" +
+ " constant #36 utf8: \"out\"\n" +
+ " constant #37 utf8: \"Ljava/io/PrintStream;\"\n" +
+ " constant #38 string: #39 \"Lambda\"\n" +
+ " constant #39 utf8: \"Lambda\"\n" +
+ " constant #40 method_ref: #41.#43 java/io/PrintStream.println (Ljava/lang/String;)V\n" +
+ " constant #41 class: #42 java/io/PrintStream\n" +
+ " constant #42 utf8: \"java/io/PrintStream\"\n" +
+ " constant #43 name_and_type: #44.#45 println (Ljava/lang/String;)V\n" +
+ " constant #44 utf8: \"println\"\n" +
+ " constant #45 utf8: \"(Ljava/lang/String;)V\"\n" +
+ " constant #46 utf8: \"t\"\n" +
+ " constant #47 utf8: \"Ljava/lang/Object;\"\n" +
+ " constant #48 utf8: \"LocalVariableTypeTable\"\n" +
+ " constant #49 utf8: \"TT;\"\n" +
+ " constant #50 utf8: \"SourceFile\"\n" +
+ " constant #51 utf8: \"X.java\"\n" +
+ " constant #52 utf8: \"EnclosingMethod\"\n" +
+ " constant #53 class: #54 X\n" +
+ " constant #54 utf8: \"X\"\n" +
+ " constant #55 name_and_type: #56.#14 foo ()V\n" +
+ " constant #56 utf8: \"foo\"\n" +
+ " constant #57 method_ref: #58.#60 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #58 class: #59 java/lang/invoke/LambdaMetafactory\n" +
+ " constant #59 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
+ " constant #60 name_and_type: #61.#62 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #61 utf8: \"metafactory\"\n" +
+ " constant #62 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #63 method handle: invokestatic (6) #57 \n" +
+ " constant #64 utf8: \"BootstrapMethods\"\n" +
+ " constant #65 method type: #14 ()V\n" +
+ " constant #66 method_ref: #1.#67 X$1Y.lambda$0 ()V\n" +
+ " constant #67 name_and_type: #31.#14 lambda$0 ()V\n" +
+ " constant #68 method handle: invokestatic (6) #66 \n" +
+ " constant #69 method type: #14 ()V\n" +
+ " constant #70 utf8: \"InnerClasses\"\n" +
+ " constant #71 utf8: \"Y\"\n" +
+ " constant #72 class: #73 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #73 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #74 class: #75 java/lang/invoke/MethodHandles\n" +
+ " constant #75 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #76 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LX;\n" +
" final synthetic X this$0;\n" +
@@ -2306,7 +2233,7 @@
" // Signature: ()TT;\n" +
" // Stack: 1, Locals: 1\n" +
" java.lang.Object goo();\n" +
- " 0 invokedynamic 0 lambda$() : I [26]\n" +
+ " 0 invokedynamic 0 doit() : I [26]\n" +
" 5 invokeinterface I.doit() : void [27] [nargs: 1]\n" +
" 10 aconst_null\n" +
" 11 areturn\n" +
@@ -2322,9 +2249,9 @@
" private static synthetic void lambda$0();\n" +
" 0 aconst_null\n" +
" 1 astore_0 [t]\n" +
- " 2 getstatic java.lang.System.out : java.io.PrintStream [33]\n" +
- " 5 ldc <String \"Lambda\"> [39]\n" +
- " 7 invokevirtual java.io.PrintStream.println(java.lang.String) : void [41]\n" +
+ " 2 getstatic java.lang.System.out : java.io.PrintStream [32]\n" +
+ " 5 ldc <String \"Lambda\"> [38]\n" +
+ " 7 invokevirtual java.io.PrintStream.println(java.lang.String) : void [40]\n" +
" 10 return\n" +
" Line numbers:\n" +
" [pc: 0, line: 9]\n" +
@@ -2337,12 +2264,12 @@
"\n" +
" Inner classes:\n" +
" [inner class info: #1 X$1Y, outer class info: #0\n" +
- " inner name: #72 Y, accessflags: 0 default],\n" +
- " [inner class info: #73 java/lang/invoke/MethodHandles$Lookup, outer class info: #75 java/lang/invoke/MethodHandles\n" +
- " inner name: #77 Lookup, accessflags: 25 public static final]\n" +
- " Enclosing Method: #54 #56 X.foo()V\n" +
+ " inner name: #71 Y, accessflags: 0 default],\n" +
+ " [inner class info: #72 java/lang/invoke/MethodHandles$Lookup, outer class info: #74 java/lang/invoke/MethodHandles\n" +
+ " inner name: #76 Lookup, accessflags: 25 public static final]\n" +
+ " Enclosing Method: #53 #55 X.foo()V\n" +
"Bootstrap methods:\n" +
- " 0 : # 64 arguments: {#66,#69,#70}\n" +
+ " 0 : # 63 arguments: {#65,#68,#69}\n" +
"}";
verifyClassFile(expectedOutput, "X$1Y.class", ClassFileBytesDisassembler.SYSTEM);
@@ -2402,61 +2329,60 @@
" constant #20 utf8: \"()Ljava/lang/Object;\"\n" +
" constant #21 utf8: \"Signature\"\n" +
" constant #22 utf8: \"()TT;\"\n" +
- " constant #23 name_and_type: #24.#25 lambda$ ()LI;\n" +
- " constant #24 utf8: \"lambda$\"\n" +
+ " constant #23 name_and_type: #24.#25 doit ()LI;\n" +
+ " constant #24 utf8: \"doit\"\n" +
" constant #25 utf8: \"()LI;\"\n" +
- " constant #26 invoke dynamic: #0 #23 lambda$ ()LI;\n" +
+ " constant #26 invoke dynamic: #0 #23 doit ()LI;\n" +
" constant #27 interface_method_ref: #28.#30 I.doit ()V\n" +
" constant #28 class: #29 I\n" +
" constant #29 utf8: \"I\"\n" +
- " constant #30 name_and_type: #31.#14 doit ()V\n" +
- " constant #31 utf8: \"doit\"\n" +
- " constant #32 utf8: \"lambda$0\"\n" +
- " constant #33 field_ref: #34.#36 java/lang/System.out Ljava/io/PrintStream;\n" +
- " constant #34 class: #35 java/lang/System\n" +
- " constant #35 utf8: \"java/lang/System\"\n" +
- " constant #36 name_and_type: #37.#38 out Ljava/io/PrintStream;\n" +
- " constant #37 utf8: \"out\"\n" +
- " constant #38 utf8: \"Ljava/io/PrintStream;\"\n" +
- " constant #39 string: #40 \"Lambda\"\n" +
- " constant #40 utf8: \"Lambda\"\n" +
- " constant #41 method_ref: #42.#44 java/io/PrintStream.println (Ljava/lang/String;)V\n" +
- " constant #42 class: #43 java/io/PrintStream\n" +
- " constant #43 utf8: \"java/io/PrintStream\"\n" +
- " constant #44 name_and_type: #45.#46 println (Ljava/lang/String;)V\n" +
- " constant #45 utf8: \"println\"\n" +
- " constant #46 utf8: \"(Ljava/lang/String;)V\"\n" +
- " constant #47 utf8: \"t\"\n" +
- " constant #48 utf8: \"Ljava/lang/Object;\"\n" +
- " constant #49 utf8: \"LocalVariableTypeTable\"\n" +
- " constant #50 utf8: \"TT;\"\n" +
- " constant #51 utf8: \"SourceFile\"\n" +
- " constant #52 utf8: \"X.java\"\n" +
- " constant #53 utf8: \"EnclosingMethod\"\n" +
- " constant #54 class: #55 X\n" +
- " constant #55 utf8: \"X\"\n" +
- " constant #56 name_and_type: #57.#14 foo ()V\n" +
- " constant #57 utf8: \"foo\"\n" +
- " constant #58 method_ref: #59.#61 java/lang/invoke/LambdaMetafactory.metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #59 class: #60 java/lang/invoke/LambdaMetafactory\n" +
- " constant #60 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
- " constant #61 name_and_type: #62.#63 metaFactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
- " constant #62 utf8: \"metaFactory\"\n" +
- " constant #63 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
- " constant #64 method handle: invokestatic (6) #58 \n" +
- " constant #65 utf8: \"BootstrapMethods\"\n" +
- " constant #66 method handle: invokeinterface (9) #27 \n" +
- " constant #67 method_ref: #1.#68 X$1Y.lambda$0 ()V\n" +
- " constant #68 name_and_type: #32.#14 lambda$0 ()V\n" +
- " constant #69 method handle: invokestatic (6) #67 \n" +
- " constant #70 method type: #14 ()V\n" +
- " constant #71 utf8: \"InnerClasses\"\n" +
- " constant #72 utf8: \"Y\"\n" +
- " constant #73 class: #74 java/lang/invoke/MethodHandles$Lookup\n" +
- " constant #74 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
- " constant #75 class: #76 java/lang/invoke/MethodHandles\n" +
- " constant #76 utf8: \"java/lang/invoke/MethodHandles\"\n" +
- " constant #77 utf8: \"Lookup\"\n" +
+ " constant #30 name_and_type: #24.#14 doit ()V\n" +
+ " constant #31 utf8: \"lambda$0\"\n" +
+ " constant #32 field_ref: #33.#35 java/lang/System.out Ljava/io/PrintStream;\n" +
+ " constant #33 class: #34 java/lang/System\n" +
+ " constant #34 utf8: \"java/lang/System\"\n" +
+ " constant #35 name_and_type: #36.#37 out Ljava/io/PrintStream;\n" +
+ " constant #36 utf8: \"out\"\n" +
+ " constant #37 utf8: \"Ljava/io/PrintStream;\"\n" +
+ " constant #38 string: #39 \"Lambda\"\n" +
+ " constant #39 utf8: \"Lambda\"\n" +
+ " constant #40 method_ref: #41.#43 java/io/PrintStream.println (Ljava/lang/String;)V\n" +
+ " constant #41 class: #42 java/io/PrintStream\n" +
+ " constant #42 utf8: \"java/io/PrintStream\"\n" +
+ " constant #43 name_and_type: #44.#45 println (Ljava/lang/String;)V\n" +
+ " constant #44 utf8: \"println\"\n" +
+ " constant #45 utf8: \"(Ljava/lang/String;)V\"\n" +
+ " constant #46 utf8: \"t\"\n" +
+ " constant #47 utf8: \"Ljava/lang/Object;\"\n" +
+ " constant #48 utf8: \"LocalVariableTypeTable\"\n" +
+ " constant #49 utf8: \"TT;\"\n" +
+ " constant #50 utf8: \"SourceFile\"\n" +
+ " constant #51 utf8: \"X.java\"\n" +
+ " constant #52 utf8: \"EnclosingMethod\"\n" +
+ " constant #53 class: #54 X\n" +
+ " constant #54 utf8: \"X\"\n" +
+ " constant #55 name_and_type: #56.#14 foo ()V\n" +
+ " constant #56 utf8: \"foo\"\n" +
+ " constant #57 method_ref: #58.#60 java/lang/invoke/LambdaMetafactory.metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #58 class: #59 java/lang/invoke/LambdaMetafactory\n" +
+ " constant #59 utf8: \"java/lang/invoke/LambdaMetafactory\"\n" +
+ " constant #60 name_and_type: #61.#62 metafactory (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\n" +
+ " constant #61 utf8: \"metafactory\"\n" +
+ " constant #62 utf8: \"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;\"\n" +
+ " constant #63 method handle: invokestatic (6) #57 \n" +
+ " constant #64 utf8: \"BootstrapMethods\"\n" +
+ " constant #65 method type: #14 ()V\n" +
+ " constant #66 method_ref: #1.#67 X$1Y.lambda$0 ()V\n" +
+ " constant #67 name_and_type: #31.#14 lambda$0 ()V\n" +
+ " constant #68 method handle: invokestatic (6) #66 \n" +
+ " constant #69 method type: #14 ()V\n" +
+ " constant #70 utf8: \"InnerClasses\"\n" +
+ " constant #71 utf8: \"Y\"\n" +
+ " constant #72 class: #73 java/lang/invoke/MethodHandles$Lookup\n" +
+ " constant #73 utf8: \"java/lang/invoke/MethodHandles$Lookup\"\n" +
+ " constant #74 class: #75 java/lang/invoke/MethodHandles\n" +
+ " constant #75 utf8: \"java/lang/invoke/MethodHandles\"\n" +
+ " constant #76 utf8: \"Lookup\"\n" +
" \n" +
" // Field descriptor #6 LX;\n" +
" final synthetic X this$0;\n" +
@@ -2479,7 +2405,7 @@
" // Signature: ()TT;\n" +
" // Stack: 1, Locals: 1\n" +
" java.lang.Object goo();\n" +
- " 0 invokedynamic 0 lambda$() : I [26]\n" +
+ " 0 invokedynamic 0 doit() : I [26]\n" +
" 5 invokeinterface I.doit() : void [27] [nargs: 1]\n" +
" 10 aconst_null\n" +
" 11 areturn\n" +
@@ -2495,9 +2421,9 @@
" private static synthetic void lambda$0();\n" +
" 0 aconst_null\n" +
" 1 astore_0 [t]\n" +
- " 2 getstatic java.lang.System.out : java.io.PrintStream [33]\n" +
- " 5 ldc <String \"Lambda\"> [39]\n" +
- " 7 invokevirtual java.io.PrintStream.println(java.lang.String) : void [41]\n" +
+ " 2 getstatic java.lang.System.out : java.io.PrintStream [32]\n" +
+ " 5 ldc <String \"Lambda\"> [38]\n" +
+ " 7 invokevirtual java.io.PrintStream.println(java.lang.String) : void [40]\n" +
" 10 return\n" +
" Line numbers:\n" +
" [pc: 0, line: 9]\n" +
@@ -2510,12 +2436,12 @@
"\n" +
" Inner classes:\n" +
" [inner class info: #1 X$1Y, outer class info: #0\n" +
- " inner name: #72 Y, accessflags: 0 default],\n" +
- " [inner class info: #73 java/lang/invoke/MethodHandles$Lookup, outer class info: #75 java/lang/invoke/MethodHandles\n" +
- " inner name: #77 Lookup, accessflags: 25 public static final]\n" +
- " Enclosing Method: #54 #56 X.foo()V\n" +
+ " inner name: #71 Y, accessflags: 0 default],\n" +
+ " [inner class info: #72 java/lang/invoke/MethodHandles$Lookup, outer class info: #74 java/lang/invoke/MethodHandles\n" +
+ " inner name: #76 Lookup, accessflags: 25 public static final]\n" +
+ " Enclosing Method: #53 #55 X.foo()V\n" +
"Bootstrap methods:\n" +
- " 0 : # 64 arguments: {#66,#69,#70}\n" +
+ " 0 : # 63 arguments: {#65,#68,#69}\n" +
"}";
verifyClassFile(expectedOutput, "X$1Y.class", ClassFileBytesDisassembler.SYSTEM);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodParametersAttributeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodParametersAttributeTest.java
index 85a6efc..b33a366 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodParametersAttributeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodParametersAttributeTest.java
@@ -15,6 +15,8 @@
package org.eclipse.jdt.core.tests.compiler.regression;
import java.io.File;
+import java.io.IOException;
+import java.util.Map;
import junit.framework.Test;
@@ -22,7 +24,9 @@
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.core.util.ClassFileBytesDisassembler;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
import org.eclipse.jdt.internal.compiler.env.IBinaryMethod;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
public class MethodParametersAttributeTest extends AbstractRegressionTest {
public MethodParametersAttributeTest(String name) {
@@ -36,7 +40,7 @@
// Use this static initializer to specify subset for tests
// All specified tests which does not belong to the class are skipped...
static {
-// TESTS_PREFIX = "testBug95521";
+// TESTS_PREFIX = "test012";
// TESTS_NAMES = new String[] { "testBug359495" };
// TESTS_NUMBERS = new int[] { 53 };
// TESTS_RANGE = new int[] { 23 -1,};
@@ -159,13 +163,7 @@
"}";
- int index = actualOutput.indexOf(expectedOutput);
- if (index == -1 || expectedOutput.length() == 0) {
- System.out.println(Util.displayString(actualOutput, 2));
- }
- if (index == -1) {
- assertEquals("Wrong contents", expectedOutput, actualOutput);
- }
+ assertSubstring(actualOutput, expectedOutput);
}
public void test002() throws Exception {
@@ -231,13 +229,7 @@
" Enclosing Method: #27 #28 ParameterNames.makeInnerWithCapture(Ljava/lang/String;Ljava/lang/String;)Ljava/util/concurrent/Callable;\n" +
"}";
- int index = actualOutput.indexOf(expectedOutput);
- if (index == -1 || expectedOutput.length() == 0) {
- System.out.println(Util.displayString(actualOutput, 2));
- }
- if (index == -1) {
- assertEquals("Wrong contents", expectedOutput, actualOutput);
- }
+ assertSubstring(actualOutput, expectedOutput);
}
public void test003() throws Exception {
@@ -311,13 +303,7 @@
" Enclosing Method: #26 #27 ParameterNames.localMath(Ljava/lang/String;Ljava/lang/String;)I\n" +
"}";
- int index = actualOutput.indexOf(expectedOutput);
- if (index == -1 || expectedOutput.length() == 0) {
- System.out.println(Util.displayString(actualOutput, 2));
- }
- if (index == -1) {
- assertEquals("Wrong contents", expectedOutput, actualOutput);
- }
+ assertSubstring(actualOutput, expectedOutput);
}
public void test004() throws Exception {
@@ -346,5 +332,572 @@
assertEquals("this$0", new String(methodInfos[0].getArgumentNames()[0]));
assertEquals("val$capturedB", new String(methodInfos[0].getArgumentNames()[1]));
}
+ public void test006() throws Exception {
+ // Test that the code generator can emit the names, so the ClassFileReader may read them back
+
+ this.runParameterNameTest(
+ "X.java",
+ "public class X {\n" +
+ " X(int wholeNumber) {\n" +
+ " }\n" +
+ " void foo(final float pluggedTheHoles, boolean yesItFloats) {\n" +
+ " }\n" +
+ "}");
+ try {
+ ClassFileReader classFileReader = ClassFileReader.read(OUTPUT_DIR + File.separator + "X.class");
+ IBinaryMethod[] methods = classFileReader.getMethods();
+ assertNotNull("No methods", methods);
+ assertEquals("Wrong size", 2, methods.length);
+ assertEquals("Wrong name", "<init>", new String(methods[0].getSelector()));
+ char[][] argumentNames = methods[0].getArgumentNames();
+ assertEquals("<init> should have 1 parameter", 1, argumentNames.length);
+ assertEquals("wholeNumber", new String(argumentNames[0]));
+ assertEquals("Wrong name", "foo", new String(methods[1].getSelector()));
+ assertEquals("pluggedTheHoles", new String(methods[1].getArgumentNames()[0]));
+ assertEquals("yesItFloats", new String(methods[1].getArgumentNames()[1]));
+ } catch (ClassFormatException e) {
+ assertTrue(false);
+ } catch (IOException e) {
+ assertTrue(false);
+ }
+ }
+
+ public void test007() throws Exception {
+ // Test that the code generator can emit the names, so the disassembler may read them back (same source as was compiled with javac)
+
+ this.runParameterNameTest(
+ "ParameterNames.java",
+ this.originalSource);
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "ParameterNames.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ "// Compiled from ParameterNames.java (version 1.8 : 52.0, super bit)\n" +
+ "public class ParameterNames {\n" +
+ " \n" +
+ " // Method descriptor #6 ()V\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public ParameterNames();\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 invokespecial java.lang.Object() [8]\n" +
+ " 4 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 3]\n" +
+ " \n" +
+ " // Method descriptor #12 (ID)V\n" +
+ " // Stack: 0, Locals: 4\n" +
+ " public void someMethod(int simple, double complex);\n" +
+ " 0 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 6]\n" +
+ " Method Parameters:\n" +
+ " simple\n" +
+ " final complex\n" +
+ " \n" +
+ " // Method descriptor #17 (Ljava/lang/String;Ljava/lang/String;)Ljava/util/concurrent/Callable;\n" +
+ " // Signature: (Ljava/lang/String;Ljava/lang/String;)Ljava/util/concurrent/Callable<Ljava/lang/String;>;\n" +
+ " // Stack: 4, Locals: 3\n" +
+ " public java.util.concurrent.Callable makeInnerWithCapture(java.lang.String finalMessage, java.lang.String mutableMessage);\n" +
+ " 0 new ParameterNames$1 [20]\n" +
+ " 3 dup\n" +
+ " 4 aload_0 [this]\n" +
+ " 5 aload_1 [finalMessage]\n" +
+ " 6 invokespecial ParameterNames$1(ParameterNames, java.lang.String) [22]\n" +
+ " 9 areturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 9]\n" +
+ " Method Parameters:\n" +
+ " final finalMessage\n" +
+ " mutableMessage\n" +
+ " \n" +
+ " // Method descriptor #28 (Ljava/lang/String;Ljava/lang/String;)I\n" +
+ " // Stack: 5, Locals: 4\n" +
+ " public int localMath(java.lang.String finalMessage, java.lang.String mutableMessage);\n" +
+ " 0 bipush 42\n" +
+ " 2 istore_3\n" +
+ " 3 new ParameterNames$1Local [29]\n" +
+ " 6 dup\n" +
+ " 7 aload_0 [this]\n" +
+ " 8 iconst_2\n" +
+ " 9 iload_3\n" +
+ " 10 invokespecial ParameterNames$1Local(ParameterNames, int, int) [31]\n" +
+ " 13 iconst_3\n" +
+ " 14 invokevirtual ParameterNames$1Local.calculate(int) : int [34]\n" +
+ " 17 ireturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 17]\n" +
+ " [pc: 3, line: 29]\n" +
+ " Method Parameters:\n" +
+ " final finalMessage\n" +
+ " mutableMessage\n" +
+ "\n" +
+ " Inner classes:\n" +
+ " [inner class info: #20 ParameterNames$1, outer class info: #0\n" +
+ " inner name: #0, accessflags: 0 default],\n" +
+ " [inner class info: #29 ParameterNames$1Local, outer class info: #0\n" +
+ " inner name: #41 Local, accessflags: 0 default]\n" +
+ "}";
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test008() throws Exception {
+ // Test that the code generator can emit synthetic and mandated names, just to match javac as closely as possibly
+
+ this.runParameterNameTest(
+ "ParameterNames.java",
+ this.originalSource);
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "ParameterNames$1.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ "// Compiled from ParameterNames.java (version 1.8 : 52.0, super bit)\n" +
+ "// Signature: Ljava/lang/Object;Ljava/util/concurrent/Callable<Ljava/lang/String;>;\n" +
+ "class ParameterNames$1 implements java.util.concurrent.Callable {\n" +
+ " \n" +
+ " // Field descriptor #8 LParameterNames;\n" +
+ " final synthetic ParameterNames this$0;\n" +
+ " \n" +
+ " // Field descriptor #10 Ljava/lang/String;\n" +
+ " private final synthetic java.lang.String val$finalMessage;\n" +
+ " \n" +
+ " // Method descriptor #12 (LParameterNames;Ljava/lang/String;)V\n" +
+ " // Stack: 2, Locals: 3\n" +
+ " ParameterNames$1(ParameterNames this$0, java.lang.String val$finalMessage);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_1 [this$0]\n" +
+ " 2 putfield ParameterNames$1.this$0 : ParameterNames [14]\n" +
+ " 5 aload_0 [this]\n" +
+ " 6 aload_2 [val$finalMessage]\n" +
+ " 7 putfield ParameterNames$1.val$finalMessage : java.lang.String [16]\n" +
+ " 10 aload_0 [this]\n" +
+ " 11 invokespecial java.lang.Object() [18]\n" +
+ " 14 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " [pc: 10, line: 9]\n" +
+ " Method Parameters:\n" +
+ " final mandated this$0\n" +
+ " final synthetic val$finalMessage\n" +
+ " \n" +
+ " // Method descriptor #24 ()Ljava/lang/String;\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public java.lang.String call() throws java.lang.Exception;\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 getfield ParameterNames$1.val$finalMessage : java.lang.String [16]\n" +
+ " 4 areturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 11]\n" +
+ " \n" +
+ " // Method descriptor #28 ()Ljava/lang/Object;\n" +
+ " // Stack: 1, Locals: 1\n" +
+ " public bridge synthetic java.lang.Object call() throws java.lang.Exception;\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 invokevirtual ParameterNames$1.call() : java.lang.String [29]\n" +
+ " 4 areturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ "\n" +
+ " Inner classes:\n" +
+ " [inner class info: #1 ParameterNames$1, outer class info: #0\n" +
+ " inner name: #0, accessflags: 0 default]\n" +
+ " Enclosing Method: #36 #38 ParameterNames.makeInnerWithCapture(Ljava/lang/String;Ljava/lang/String;)Ljava/util/concurrent/Callable;\n" +
+ "}" ;
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test009() throws Exception {
+ // Test that the code generator can emit synthetic and mandated names, just to match javac as closely as possibly
+
+ this.runParameterNameTest(
+ "FancyEnum.java",
+ "\n" +
+ "public enum FancyEnum {\n" +
+ " ONE(1), TWO(2);\n" +
+ " \n" +
+ " private FancyEnum(final int v) { this.var = v; }\n" +
+ " int var;\n" +
+ "}\n" +
+ "");
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "FancyEnum.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ "// Compiled from FancyEnum.java (version 1.8 : 52.0, super bit)\n" +
+ "// Signature: Ljava/lang/Enum<LFancyEnum;>;\n" +
+ "public final enum FancyEnum {\n" +
+ " \n" +
+ " // Field descriptor #6 LFancyEnum;\n" +
+ " public static final enum FancyEnum ONE;\n" +
+ " \n" +
+ " // Field descriptor #6 LFancyEnum;\n" +
+ " public static final enum FancyEnum TWO;\n" +
+ " \n" +
+ " // Field descriptor #9 I\n" +
+ " int var;\n" +
+ " \n" +
+ " // Field descriptor #11 [LFancyEnum;\n" +
+ " private static final synthetic FancyEnum[] ENUM$VALUES;\n" +
+ " \n" +
+ " // Method descriptor #13 ()V\n" +
+ " // Stack: 5, Locals: 0\n" +
+ " static {};\n" +
+ " 0 new FancyEnum [1]\n" +
+ " 3 dup\n" +
+ " 4 ldc <String \"ONE\"> [15]\n" +
+ " 6 iconst_0\n" +
+ " 7 iconst_1\n" +
+ " 8 invokespecial FancyEnum(java.lang.String, int, int) [16]\n" +
+ " 11 putstatic FancyEnum.ONE : FancyEnum [20]\n" +
+ " 14 new FancyEnum [1]\n" +
+ " 17 dup\n" +
+ " 18 ldc <String \"TWO\"> [22]\n" +
+ " 20 iconst_1\n" +
+ " 21 iconst_2\n" +
+ " 22 invokespecial FancyEnum(java.lang.String, int, int) [16]\n" +
+ " 25 putstatic FancyEnum.TWO : FancyEnum [23]\n" +
+ " 28 iconst_2\n" +
+ " 29 anewarray FancyEnum [1]\n" +
+ " 32 dup\n" +
+ " 33 iconst_0\n" +
+ " 34 getstatic FancyEnum.ONE : FancyEnum [20]\n" +
+ " 37 aastore\n" +
+ " 38 dup\n" +
+ " 39 iconst_1\n" +
+ " 40 getstatic FancyEnum.TWO : FancyEnum [23]\n" +
+ " 43 aastore\n" +
+ " 44 putstatic FancyEnum.ENUM$VALUES : FancyEnum[] [25]\n" +
+ " 47 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 3]\n" +
+ " [pc: 28, line: 2]\n" +
+ " \n" +
+ " // Method descriptor #19 (Ljava/lang/String;II)V\n" +
+ " // Stack: 3, Locals: 4\n" +
+ " private FancyEnum(java.lang.String $enum$name, int $enum$ordinal, int v);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_1 [$enum$name]\n" +
+ " 2 iload_2 [$enum$ordinal]\n" +
+ " 3 invokespecial java.lang.Enum(java.lang.String, int) [28]\n" +
+ " 6 aload_0 [this]\n" +
+ " 7 iload_3 [v]\n" +
+ " 8 putfield FancyEnum.var : int [31]\n" +
+ " 11 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 5]\n" +
+ " Method Parameters:\n" +
+ " synthetic $enum$name\n" +
+ " synthetic $enum$ordinal\n" +
+ " final v\n" +
+ " \n" +
+ " // Method descriptor #38 ()[LFancyEnum;\n" +
+ " // Stack: 5, Locals: 3\n" +
+ " public static FancyEnum[] values();\n" +
+ " 0 getstatic FancyEnum.ENUM$VALUES : FancyEnum[] [25]\n" +
+ " 3 dup\n" +
+ " 4 astore_0\n" +
+ " 5 iconst_0\n" +
+ " 6 aload_0\n" +
+ " 7 arraylength\n" +
+ " 8 dup\n" +
+ " 9 istore_1\n" +
+ " 10 anewarray FancyEnum [1]\n" +
+ " 13 dup\n" +
+ " 14 astore_2\n" +
+ " 15 iconst_0\n" +
+ " 16 iload_1\n" +
+ " 17 invokestatic java.lang.System.arraycopy(java.lang.Object, int, java.lang.Object, int, int) : void [39]\n" +
+ " 20 aload_2\n" +
+ " 21 areturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " \n" +
+ " // Method descriptor #46 (Ljava/lang/String;)LFancyEnum;\n" +
+ " // Stack: 2, Locals: 1\n" +
+ " public static FancyEnum valueOf(java.lang.String name);\n" +
+ " 0 ldc <Class FancyEnum> [1]\n" +
+ " 2 aload_0 [name]\n" +
+ " 3 invokestatic java.lang.Enum.valueOf(java.lang.Class, java.lang.String) : java.lang.Enum [47]\n" +
+ " 6 checkcast FancyEnum [1]\n" +
+ " 9 areturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " Method Parameters:\n" +
+ " mandated name\n" +
+ "}";
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test010() throws Exception {
+ // Test that the non private inner class gets a mandated enclosing instance parameter.
+
+ this.runParameterNameTest(
+ "X.java",
+ "public class X {\n" +
+ " class Y {}\n" +
+ "}\n"
+ );
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "X$Y.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " X$Y(X this$0);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_1 [this$0]\n" +
+ " 2 putfield X$Y.this$0 : X [10]\n" +
+ " 5 aload_0 [this]\n" +
+ " 6 invokespecial java.lang.Object() [12]\n" +
+ " 9 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 2]\n" +
+ " Method Parameters:\n" +
+ " final mandated this$0\n" +
+ "\n";
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test011() throws Exception {
+ // Test that a private inner class does not get a mandated enclosing instance parameter.
+
+ this.runParameterNameTest(
+ "X.java",
+ "public class X {\n" +
+ " private class Y {}\n" +
+ "}\n"
+ );
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "X$Y.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " private X$Y(X this$0);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_1 [this$0]\n" +
+ " 2 putfield X$Y.this$0 : X [10]\n" +
+ " 5 aload_0 [this]\n" +
+ " 6 invokespecial java.lang.Object() [12]\n" +
+ " 9 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 2]\n" +
+ " Method Parameters:\n" +
+ " final synthetic this$0\n" +
+ "\n";
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test012() throws Exception {
+
+ this.runParameterNameTest(
+ "X.java",
+ "public class X {\n" +
+ " void foo() {\n" +
+ " new Y().new Z() {\n" +
+ " };\n" +
+ " }\n" +
+ "}\n" +
+ "class Y {\n" +
+ " class Z {}\n" +
+ "}\n"
+ );
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "X$1.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " X$1(X this$0, Y this$1);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_1 [this$0]\n" +
+ " 2 putfield X$1.this$0 : X [10]\n" +
+ " 5 aload_0 [this]\n" +
+ " 6 aload_2 [this$1]\n" +
+ " 7 invokespecial Y$Z(Y) [12]\n" +
+ " 10 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " [pc: 5, line: 3]\n" +
+ " Method Parameters:\n" +
+ " final synthetic this$0\n" +
+ " final mandated this$1\n" +
+ "\n";
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test013() throws Exception {
+ // Test that synthesized enum constructor arguments show up as synthetic
+
+ this.runParameterNameTest(
+ "FancyEnum.java",
+ "\n" +
+ "public enum FancyEnum {\n" +
+ " ONE, TWO;\n" +
+ "}\n" +
+ "");
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "FancyEnum.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " private FancyEnum(java.lang.String $enum$name, int $enum$ordinal);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_1 [$enum$name]\n" +
+ " 2 iload_2 [$enum$ordinal]\n" +
+ " 3 invokespecial java.lang.Enum(java.lang.String, int) [26]\n" +
+ " 6 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 2]\n" +
+ " Method Parameters:\n" +
+ " synthetic $enum$name\n" +
+ " synthetic $enum$ordinal\n" +
+ " \n";
+
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test014() throws Exception {
+ // Test that the name argument of enum valueOf shows up as mandated
+
+ this.runParameterNameTest(
+ "FancyEnum.java",
+ "\n" +
+ "public enum FancyEnum {\n" +
+ " ONE, TWO;\n" +
+ "}\n" +
+ "");
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "FancyEnum.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " public static FancyEnum valueOf(java.lang.String name);\n" +
+ " 0 ldc <Class FancyEnum> [1]\n" +
+ " 2 aload_0 [name]\n" +
+ " 3 invokestatic java.lang.Enum.valueOf(java.lang.Class, java.lang.String) : java.lang.Enum [40]\n" +
+ " 6 checkcast FancyEnum [1]\n" +
+ " 9 areturn\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " Method Parameters:\n" +
+ " mandated name\n";
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ public void test015() throws Exception {
+ // Test that the name argument of enum valueOf shows up as mandated
+
+ this.runParameterNameTest(
+ "InnerLocalClassTest.java",
+ "public class InnerLocalClassTest {\n" +
+ " void test() {\n" +
+ " class Local { }\n" +
+ " new Local() { };\n" +
+ " } \n" +
+ "}\n");
+
+ ClassFileBytesDisassembler disassembler = ToolFactory.createDefaultClassFileBytesDisassembler();
+ String path = OUTPUT_DIR + File.separator + "InnerLocalClassTest$1.class";
+ byte[] classFileBytes = org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(new File(path));
+ String actualOutput =
+ disassembler.disassemble(
+ classFileBytes,
+ "\n",
+ ClassFileBytesDisassembler.DETAILED);
+
+ String expectedOutput =
+ " InnerLocalClassTest$1(InnerLocalClassTest this$0, InnerLocalClassTest this$1);\n" +
+ " 0 aload_0 [this]\n" +
+ " 1 aload_2 [this$1]\n" +
+ " 2 putfield InnerLocalClassTest$1.this$0 : InnerLocalClassTest [10]\n" +
+ " 5 aload_0 [this]\n" +
+ " 6 aload_1 [this$0]\n" +
+ " 7 invokespecial InnerLocalClassTest$1Local(InnerLocalClassTest) [12]\n" +
+ " 10 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 1]\n" +
+ " [pc: 5, line: 4]\n" +
+ " Method Parameters:\n" +
+ " final synthetic this$0\n" +
+ " final synthetic this$1\n";
+ assertSubstring(actualOutput, expectedOutput);
+ }
+
+ private void runParameterNameTest(String fileName, String body) {
+ Map compilerOptions = getCompilerOptions();
+ compilerOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
+ compilerOptions.put(CompilerOptions.OPTION_MethodParametersAttribute, CompilerOptions.GENERATE);
+ this.runConformTest(
+ new String[] {
+ fileName,
+ body
+ },
+ compilerOptions /* custom options */
+ );
+ }
+
+ private void assertSubstring(String actualOutput, String expectedOutput) {
+ int index = actualOutput.indexOf(expectedOutput);
+ if (index == -1 || expectedOutput.length() == 0) {
+ System.out.println(Util.displayString(actualOutput, 2));
+ }
+ if (index == -1) {
+ assertEquals("Wrong contents", expectedOutput, actualOutput);
+ }
+ }
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java
index 2fbae53..36158ba 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java
@@ -15,6 +15,7 @@
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
* Bug 384687 - [1.8] Wildcard type arguments should be rejected for lambda and reference expressions
+ * Bug 404657 - [1.8][compiler] Analysis for effectively final variables fails to consider loops
* Stephan Herrmann - Contribution for
* bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super via I.super.m() syntax
* bug 404728 - [1.8]NPE on QualifiedSuperReference error
@@ -6877,6 +6878,192 @@
null /* custom options */
);
}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=409544
+// Bug 409544 - [1.8][compiler] Any local variable used but not declared in a lambda body must be definitely assigned before the lambda body.
+public void test409544() {
+ this.runNegativeTest(
+ new String[] {
+ "Sample.java",
+ "public class Sample{\n" +
+ " interface Int { void setInt(int[] i); }\n" +
+ " public static void main(String[] args) {\n" +
+ " int j;\n" +
+ " Int int1 = (int... i) -> {\n" +
+ " j=10;\n" +
+ " };\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in Sample.java (at line 6)\n" +
+ " j=10;\n" +
+ " ^\n" +
+ "Variable j is required to be final or effectively final\n" +
+ "----------\n",
+ null /* no extra class libraries */,
+ true /* flush output directory */,
+ null /* custom options */
+ );
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=409544
+// Bug 409544 - [1.8][compiler] Any local variable used but not declared in a lambda body must be definitely assigned before the lambda body.
+public void test409544b() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " interface Int {\n" +
+ " void setInt(int[] i);\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ "\n" +
+ " int j = 0;\n" +
+ " Int i = new Int() {\n" +
+ " @Override\n" +
+ " public void setInt(int[] i) {\n" +
+ " j = 10;\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 10)\n" +
+ " public void setInt(int[] i) {\n" +
+ " ^\n" +
+ "The parameter i is hiding another local variable defined in an enclosing scope\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 11)\n" +
+ " j = 10;\n" +
+ " ^\n" +
+ "Variable j is required to be final or effectively final\n" +
+ "----------\n",
+ null /* no extra class libraries */,
+ true /* flush output directory */,
+ null /* custom options */
+ );
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=415844
+// Bug 415844 - [1.8][compiler] Blank final initialized in a lambda expression should not pass
+public void test415844a() {
+ this.runNegativeTest(
+ new String[] {
+ "Sample.java",
+ "public class Sample{\n" +
+ " interface Int { void setInt(int i); }\n" +
+ " public static void main(String[] args) {\n" +
+ " final int j;\n" +
+ " Int int1 = (int i) -> {\n" +
+ " j=10;\n" +
+ " };\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in Sample.java (at line 6)\n" +
+ " j=10;\n" +
+ " ^\n" +
+ "The final local variable j cannot be assigned, since it is defined in an enclosing type\n" +
+ "----------\n",
+ null /* no extra class libraries */,
+ true /* flush output directory */,
+ null /* custom options */
+ );
+}
+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=415844
+// Bug 415844 - [1.8][compiler] Blank final initialized in a lambda expression should not pass
+public void test415844b() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " interface Int {\n" +
+ " void setInt(int[] i);\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " final int j;\n" +
+ " Int i = new Int() {\n" +
+ " @Override\n" +
+ " public void setInt(int[] i) {\n" +
+ " j = 10;\n" +
+ " }\n" +
+ " };\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 9)\n" +
+ " public void setInt(int[] i) {\n" +
+ " ^\n" +
+ "The parameter i is hiding another local variable defined in an enclosing scope\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 10)\n" +
+ " j = 10;\n" +
+ " ^\n" +
+ "The final local variable j cannot be assigned, since it is defined in an enclosing type\n" +
+ "----------\n",
+ null /* no extra class libraries */,
+ true /* flush output directory */,
+ null /* custom options */
+ );
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=404657 [1.8][compiler] Analysis for effectively final variables fails to consider loops
+public void test404657_final() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void executeLater(Runnable r) { /* ... */\n" +
+ " }\n" +
+ " public int testFinally() {\n" +
+ " int n;\n" +
+ " try {\n" +
+ " n = 42;\n" +
+ " executeLater(() -> System.out.println(n)); // Error: n is not effectively final\n" +
+ " } finally {\n" +
+ " n = 23;\n" +
+ " }\n" +
+ " return n;\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ ""
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " executeLater(() -> System.out.println(n)); // Error: n is not effectively final\n" +
+ " ^\n" +
+ "Variable n is required to be final or effectively final\n" +
+ "----------\n"
+ );
+}
+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=404657 [1.8][compiler] Analysis for effectively final variables fails to consider loops
+public void test404657_loop() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void executeLater(Runnable r) { /* ... */\n" +
+ " }\n" +
+ " public void testLoop() {\n" +
+ " int n;\n" +
+ " for (int i = 0; i < 3; i++) {\n" +
+ " n = i;\n" +
+ " executeLater(() -> System.out.println(n)); // Error: n is not effectively final\n" +
+ " }\n" +
+ " }\n" +
+ "\n" +
+ "}\n" +
+ ""
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " executeLater(() -> System.out.println(n)); // Error: n is not effectively final\n" +
+ " ^\n" +
+ "Variable n is required to be final or effectively final\n" +
+ "----------\n"
+ );
+}
public static Class testClass() {
return NegativeLambdaExpressionsTest.class;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
index 5f2df4a..568fc37 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java
@@ -2932,21 +2932,6 @@
"}\n" +
"@java.lang.annotation.Target ({java.lang.annotation.ElementType.TYPE_USE})\n" +
"@interface Marker8 {\n" +
- "}\n",
-
- "java/lang/annotation/ElementType.java",
- "package java.lang.annotation;\n" +
- "public enum ElementType {\n" +
- " TYPE,\n" +
- " FIELD,\n" +
- " METHOD,\n" +
- " PARAMETER,\n" +
- " CONSTRUCTOR,\n" +
- " LOCAL_VARIABLE,\n" +
- " ANNOTATION_TYPE,\n" +
- " PACKAGE,\n" +
- " TYPE_PARAMETER,\n" +
- " TYPE_USE\n" +
"}\n"
},
"----------\n" +
@@ -2965,8 +2950,12 @@
" RuntimeInvisibleAnnotations: \n" +
" #24 @Marker78(\n" +
" )\n" +
- " #25 @Marker7(\n" +
- " )\n";
+ " #25 @Marker8(\n" +
+ " )\n" +
+ " #26 @Marker7(\n" +
+ " )\n" +
+ " Attribute: MissingTypes Length: 4\n" +
+ "}";
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=392119, variant with explicit class file retention.
@@ -2989,21 +2978,6 @@
"@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS)\n" +
"@java.lang.annotation.Target ({java.lang.annotation.ElementType.TYPE_USE})\n" +
"@interface Marker8 {\n" +
- "}\n",
-
- "java/lang/annotation/ElementType.java",
- "package java.lang.annotation;\n" +
- "public enum ElementType {\n" +
- " TYPE,\n" +
- " FIELD,\n" +
- " METHOD,\n" +
- " PARAMETER,\n" +
- " CONSTRUCTOR,\n" +
- " LOCAL_VARIABLE,\n" +
- " ANNOTATION_TYPE,\n" +
- " PACKAGE,\n" +
- " TYPE_PARAMETER,\n" +
- " TYPE_USE\n" +
"}\n"
},
"----------\n" +
@@ -3022,11 +2996,15 @@
" RuntimeInvisibleAnnotations: \n" +
" #24 @Marker78(\n" +
" )\n" +
- " #25 @Marker7(\n" +
- " )\n";
+ " #25 @Marker8(\n" +
+ " )\n" +
+ " #26 @Marker7(\n" +
+ " )\n" +
+ " Attribute: MissingTypes Length: 4\n" +
+ "}";
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
}
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=392119, variant with explicit class file retention.
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=392119, variant with explicit runtime retention.
public void test392119c() throws Exception {
this.runNegativeTest(
new String[] {
@@ -3046,21 +3024,6 @@
"@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)\n" +
"@java.lang.annotation.Target ({java.lang.annotation.ElementType.TYPE_USE})\n" +
"@interface Marker8 {\n" +
- "}\n",
-
- "java/lang/annotation/ElementType.java",
- "package java.lang.annotation;\n" +
- "public enum ElementType {\n" +
- " TYPE,\n" +
- " FIELD,\n" +
- " METHOD,\n" +
- " PARAMETER,\n" +
- " CONSTRUCTOR,\n" +
- " LOCAL_VARIABLE,\n" +
- " ANNOTATION_TYPE,\n" +
- " PACKAGE,\n" +
- " TYPE_PARAMETER,\n" +
- " TYPE_USE\n" +
"}\n"
},
"----------\n" +
@@ -3079,7 +3042,9 @@
" RuntimeVisibleAnnotations: \n" +
" #24 @Marker78(\n" +
" )\n" +
- " #25 @Marker7(\n" +
+ " #25 @Marker8(\n" +
+ " )\n" +
+ " #26 @Marker7(\n" +
" )\n";
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
}
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 bfe5bd0..a42b4ea 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
@@ -22,6 +22,7 @@
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
// see bug 186342 - [compiler][null] Using annotations for null checking
public class NullAnnotationTest extends AbstractNullAnnotationTest {
@@ -58,10 +59,10 @@
? "Null type safety: "
: "Null type safety (type annotations): ";
}
-String mismatch_NonNull_Null(String type) {
+String mismatch_NonNull_Null(String type7, String type8) {
return (this.complianceLevel < ClassFileConstants.JDK1_8)
- ? "Null type mismatch: required \'@NonNull "+type+"\' but the provided value is null\n"
- : "Null type mismatch: required \'@NonNull "+type+"\' but the provided value is null\n";
+ ? "Null type mismatch: required \'@NonNull "+type7+"\' but the provided value is null\n"
+ : "Null type mismatch: required \'@NonNull "+type8+"\' but the provided value is null\n";
}
String variableMayBeNull(String var) {
return (this.complianceLevel < ClassFileConstants.JDK1_8)
@@ -495,7 +496,7 @@
"2. ERROR in X.java (at line 4)\n" +
" ContainingInner2.Inner inner = container.new Inner(null);\n" +
" ^^^^\n" +
- mismatch_NonNull_Null("Object") +
+ mismatch_NonNull_Null("Object", "Object") +
"----------\n" /* compiler output */);
}
// a method of a local class has a non-null parameter, client passes null
@@ -6153,6 +6154,81 @@
"----------\n");
}
+// missing type in constructor declaration must not cause NPE in QAE#resolveType(..)
+public void testBug415850_a() {
+ this.runNegativeTest(
+ new String[] {
+ "X.java", //-----------------------------------------------------------------------
+ "public class X {\n" +
+ " void foo(X1 x1) {\n" +
+ " Object o = new X1(x1){};\n" +
+ " }\n" +
+ "}\n",
+ "X1.java", //-----------------------------------------------------------------------
+ "public class X1 {\n" +
+ " public X1(Zork z) {}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " Object o = new X1(x1){};\n" +
+ " ^^^^^^\n" +
+ "The constructor X1(Zork) refers to the missing type Zork\n" +
+ "----------\n" +
+ "----------\n" +
+ "1. ERROR in X1.java (at line 2)\n" +
+ " public X1(Zork z) {}\n" +
+ " ^^^^\n" +
+ "Zork cannot be resolved to a type\n" +
+ "----------\n");
+}
+
+// avoid NPE in BinaryTypeBinding.getField(..) due to recursive dependency enum->package-info->annotation->enum
+public void testBug415850_b() {
+ runConformTestWithLibs(
+ new String[] {
+ "p/package-info.java",
+ "@p.Annot(state=p.MyEnum.BROKEN)\n" +
+ "package p;",
+ "p/Annot.java",
+ "package p;\n" +
+ "@Annot(state=MyEnum.KO)\n" +
+ "public @interface Annot {\n" +
+ " MyEnum state() default MyEnum.KO;\n" +
+ "}",
+ "p/MyEnum.java",
+ "package p;\n" +
+ "@Annot(state=MyEnum.KO)\n" +
+ "public enum MyEnum {\n" +
+ " WORKS, OK, KO, BROKEN, ;\n" +
+ "}",
+ "test180/Test.java",
+ "package test180;\n" +
+ "import p.MyEnum;\n" +
+ "import p.Annot;\n" +
+ "@Annot(state=MyEnum.OK)\n" +
+ "public class Test {}",
+ },
+ getCompilerOptions(),
+ ""
+ );
+ Map options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_Process_Annotations, CompilerOptions.ENABLED);
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import test180.Test;\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(Test.class);\n" +
+ " }\n" +
+ "}"
+ },
+ options,
+ "",
+ "class test180.Test");
+}
+
// Bug 403086 - [compiler][null] include the effect of 'assert' in syntactic null analysis for fields
public void testBug403086_1() {
Map customOptions = getCompilerOptions();
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
index 58d618f..a169fe1 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java
@@ -29,7 +29,7 @@
// Static initializer to specify tests subset using TESTS_* static variables
// All specified tests which do not belong to the class are skipped...
static {
-// TESTS_NAMES = new String[] { "testArrayType_10" };
+// TESTS_NAMES = new String[] { "testCompatibility6" };
// TESTS_NUMBERS = new int[] { 561 };
// TESTS_RANGE = new int[] { 1, 2049 };
}
@@ -135,6 +135,10 @@
" System.out.print(l.get(1).toString()); // problem: retrieved element can be null\n" +
" l.add(null);\n" +
" }\n" +
+ " void bar2(java.util.List<java.lang.@Dummy @Nullable Object> l2) {\n" +
+ " System.out.print(l2.get(1).toString()); // problem: retrieved element can be null\n" +
+ " l2.add(null);\n" +
+ " }\n" +
"}\n"},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
@@ -146,6 +150,11 @@
" System.out.print(l.get(1).toString()); // problem: retrieved element can be null\n" +
" ^^^^^^^^\n" +
"Potential null pointer access: The method get(int) may return null\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 13)\n" +
+ " System.out.print(l2.get(1).toString()); // problem: retrieved element can be null\n" +
+ " ^^^^^^^^^\n" +
+ "Potential null pointer access: The method get(int) may return null\n" +
"----------\n");
}
@@ -153,6 +162,13 @@
public void test_nonnull_list_elements_03() {
runNegativeTestWithLibs(
new String[] {
+ "Dummy.java",
+ "import static java.lang.annotation.ElementType.*;\n" +
+ "import java.lang.annotation.*;\n" +
+ "@Retention(RetentionPolicy.CLASS)\n" +
+ "@Target({METHOD,PARAMETER,LOCAL_VARIABLE,TYPE_USE})\n" +
+ "public @interface Dummy {\n" +
+ "}\n",
"X.java",
"import org.eclipse.jdt.annotation.*;\n" +
"import java.util.List;\n" +
@@ -161,10 +177,14 @@
" System.out.print(l.get(0).toString()); // problem: l may be null\n" +
" l.add(null); // problem: cannot insert 'null' into this list\n" +
" }\n" +
- " void bar(@Nullable List<@NonNull Object> l) {\n" +
+ " void bar(@Nullable List<java.lang.@NonNull Object> l) {\n" +
" System.out.print(l.get(0).toString()); // problem: l may be null\n" +
" l.add(0, null); // problem: cannot insert 'null' into this list\n" +
" }\n" +
+ " void bar2(@Dummy java.util.@Nullable List<java.lang.@NonNull Object> l2) {\n" +
+ " System.out.print(l2.get(0).toString()); // problem: l2 may be null\n" +
+ " l2.add(0, null); // problem: cannot insert 'null' into this list\n" +
+ " }\n" +
"}\n"},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
@@ -186,6 +206,16 @@
" l.add(0, null); // problem: cannot insert \'null\' into this list\n" +
" ^^^^\n" +
"Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 13)\n" +
+ " System.out.print(l2.get(0).toString()); // problem: l2 may be null\n" +
+ " ^^\n" +
+ "Potential null pointer access: this expression has a '@Nullable' type\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 14)\n" +
+ " l2.add(0, null); // problem: cannot insert \'null\' into this list\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'@NonNull Object\' but the provided value is null\n" +
"----------\n");
}
@@ -306,7 +336,7 @@
"B.java",
"import org.eclipse.jdt.annotation.*;\n" +
"public class B {\n" +
- " public void foo(@NonNull A<Object>.@Nullable I<@NonNull String> ai) {\n" +
+ " public void foo(A<Object>.@Nullable I<@NonNull String> ai) {\n" +
" ai.foo(null); // problems: ai can be null, arg must not be null\n" +
" }\n" +
"}\n"},
@@ -718,8 +748,49 @@
});
}
+ // issue from https://bugs.eclipse.org/bugs/show_bug.cgi?id=403216#c7
+ public void testBug403216_2() {
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.*;\n" +
+ "public class X {\n" +
+ " void test(List<@NonNull String> strings) {\n" +
+ " List<String> someStrings;\n" +
+ " someStrings = strings;\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=403216#c9
+ public void testBug403216_3() {
+ runConformTestWithLibs(
+ new String[] {
+ "Test.java",
+ "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "public class Test {}\n" +
+ "\n" +
+ "class X {\n" +
+ " class Y {\n" +
+ " public void foo( @A X. @NonNull Y this) {}\n" +
+ " }\n" +
+ "}\n" +
+ "@Target(value={ElementType.TYPE_USE})\n" +
+ "@interface A {}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
// https://bugs.eclipse.org/403457 - [1.8][compiler] NPE in WildcardBinding.signature
- public void testBug403457() {
+ public void testBug403457_1() {
runNegativeTestWithLibs(
new String[] {
"X.java",
@@ -750,6 +821,33 @@
"----------\n");
}
+ // https://bugs.eclipse.org/403457 - [1.8][compiler] NPE in WildcardBinding.signature
+ // variant with null annotations
+ public void testBug403457_2() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "// import java.util.Map;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "public class X {\n" +
+ " void foo(Map<@Nullable ? super @Nullable Object, @Nullable ? extends @Nullable String> m){}\n" +
+ " void goo(Map<@Nullable ? extends @Nullable Object, @Nullable ? super @Nullable String> m){}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " void foo(Map<@Nullable ? super @Nullable Object, @Nullable ? extends @Nullable String> m){}\n" +
+ " ^^^\n" +
+ "Map cannot be resolved to a type\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " void goo(Map<@Nullable ? extends @Nullable Object, @Nullable ? super @Nullable String> m){}\n" +
+ " ^^^\n" +
+ "Map cannot be resolved to a type\n" +
+ "----------\n");
+ }
+
// storing and decoding null-type-annotations to/from classfile: RETURN_TYPE
public void testBinary01() {
Map customOptions = getCompilerOptions();
@@ -854,7 +952,7 @@
"import p.X1;\n" +
"public class Y1 {\n" +
" public void test() {\n" +
- " System.out.println(X1.f1.length);\n" +
+ " System.out.println(p.X1.f1.length);\n" +
" System.out.println(X1.f2[0].length);\n" +
" }\n" +
"}\n"
@@ -862,8 +960,8 @@
customOptions,
"----------\n" +
"1. ERROR in Y1.java (at line 4)\n" +
- " System.out.println(X1.f1.length);\n" +
- " ^^\n" + // FIXME(stephan) should point to f1, see https://bugs.eclipse.org/414380
+ " System.out.println(p.X1.f1.length);\n" +
+ " ^^\n" +
"Potential null pointer access: this expression has a '@Nullable' type\n" +
"----------\n" +
"2. ERROR in Y1.java (at line 5)\n" +
@@ -962,7 +1060,12 @@
},
customOptions,
"----------\n" +
- "1. ERROR in Y1.java (at line 6)\n" +
+ "1. ERROR in Y1.java (at line 4)\n" +
+ " X1<@Nullable String> maybeStrings;\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "Null constraint mismatch: The type \'@Nullable String\' is not a valid substitute for the type parameter \'T\' which is constrained as \'@NonNull\'\n" +
+ "----------\n" +
+ "2. ERROR in Y1.java (at line 6)\n" +
" x.<@NonNull Object>foo(new Object());\n" +
" ^^^^^^^^^^^^^^^\n" +
"Null constraint mismatch: The type '@NonNull Object' is not a valid substitute for the type parameter 'S' which is constrained as '@Nullable'\n" +
@@ -975,8 +1078,28 @@
Map customOptions = getCompilerOptions();
customOptions.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
customOptions.put(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION, JavaCore.IGNORE);
-// FIXME(stephan): change to negative tests and fill in desired error messages
-// runNegativeTestWithLibs(
+ runNegativeTestWithLibs(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "import java.util.ArrayList;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public abstract class X1<T extends @NonNull Object> extends ArrayList<T> {\n" +
+ " public <U, V extends @Nullable Object> void foo(U u, V v) {}\n" +
+ "}\n",
+ "p/X2.java",
+ "package p;\n"+
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X2<@NonNull W extends @Nullable Object> {}\n" // incompatible constraints
+ },
+ customOptions,
+ "----------\n" +
+ "1. ERROR in p\\X2.java (at line 3)\n" +
+ " public class X2<@NonNull W extends @Nullable Object> {}\n" +
+ " ^^^^^^^^^\n" +
+ "This nullness annotation conflicts with a \'@NonNull\' annotation which is effective on the same type parameter \n" +
+ "----------\n");
+ // fix the bug:
runConformTestWithLibs(
new String[] {
"p/X1.java",
@@ -985,8 +1108,11 @@
"import org.eclipse.jdt.annotation.*;\n" +
"public abstract class X1<T extends @NonNull Object> extends ArrayList<T> {\n" +
" public <U, V extends @Nullable Object> void foo(U u, V v) {}\n" +
- "}\n" +
- "class X2<@NonNull W extends @Nullable Object> {}\n" // incompatible constraints
+ "}\n",
+ "p/X2.java",
+ "package p;\n"+
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X2<@Nullable W extends Object> {}\n"
},
customOptions,
"");
@@ -994,9 +1120,11 @@
new String[] {
"Y1.java",
"import p.X1;\n" +
+ "import p.X2;\n" +
"import org.eclipse.jdt.annotation.*;\n" +
"public class Y1 {\n" +
- " X1<@Nullable String> maybeStrings;\n" + // incompatible: T is constrained to @NonNull
+ " X1<@Nullable String> maybeStrings;\n" + // incompatible: T has a bound constrained to @NonNull
+ " X2<@NonNull String> strings;\n" + // incompatible: W is constrained to @Nullable
" void test(X1<@NonNull String> x) {\n" + // OK
" x.<Y1, @NonNull Object>foo(this, new Object());\n" + // incompatible: V is constrained to @Nullable via superclass
" }\n" +
@@ -1004,7 +1132,17 @@
},
customOptions,
"----------\n" +
- "1. ERROR in Y1.java (at line 6)\n" +
+ "1. ERROR in Y1.java (at line 5)\n" +
+ " X1<@Nullable String> maybeStrings;\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "Null constraint mismatch: The type \'@Nullable String\' is not a valid substitute for the type parameter \'T\' which is constrained as \'@NonNull\'\n" +
+ "----------\n" +
+ "2. ERROR in Y1.java (at line 6)\n" +
+ " X2<@NonNull String> strings;\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "Null constraint mismatch: The type \'@NonNull String\' is not a valid substitute for the type parameter \'W\' which is constrained as \'@Nullable\'\n" +
+ "----------\n" +
+ "3. ERROR in Y1.java (at line 8)\n" +
" x.<Y1, @NonNull Object>foo(this, new Object());\n" +
" ^^^^^^^^^^^^^^^\n" +
"Null constraint mismatch: The type '@NonNull Object' is not a valid substitute for the type parameter 'V' which is constrained as '@Nullable'\n" +
@@ -1012,6 +1150,82 @@
);
}
+ // storing and decoding null-type-annotations to/from classfile: CLASS_TYPE_PARAMETER_BOUND & METHOD_TYPE_PARAMETER_BOUND
+ // variant: qualified type references
+ public void testBinary06b() {
+ Map customOptions = getCompilerOptions();
+ customOptions.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
+ customOptions.put(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION, JavaCore.IGNORE);
+ runNegativeTestWithLibs(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "import java.util.ArrayList;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public abstract class X1<T extends java.lang.@NonNull Object> extends ArrayList<T> {\n" +
+ " public <U, V extends java.lang.@Nullable Object> void foo(U u, V v) {}\n" +
+ "}\n",
+ "p/X2.java",
+ "package p;\n"+
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X2<@NonNull W extends java.lang.@Nullable Object> {}\n" // incompatible constraints
+ },
+ customOptions,
+ "----------\n" +
+ "1. ERROR in p\\X2.java (at line 3)\n" +
+ " public class X2<@NonNull W extends java.lang.@Nullable Object> {}\n" +
+ " ^^^^^^^^^\n" +
+ "This nullness annotation conflicts with a \'@NonNull\' annotation which is effective on the same type parameter \n" +
+ "----------\n");
+ // fix the bug:
+ runConformTestWithLibs(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "import java.util.ArrayList;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public abstract class X1<T extends java.lang.@NonNull Object> extends ArrayList<T> {\n" +
+ " public <U, V extends java.lang.@Nullable Object> void foo(U u, V v) {}\n" +
+ "}\n",
+ "p/X2.java",
+ "package p;\n"+
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X2<@Nullable W extends Object> {}\n"
+ },
+ customOptions,
+ "");
+ runNegativeTestWithLibs(
+ new String[] {
+ "Y1.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class Y1 {\n" +
+ " p.X1<java.lang.@Nullable String> maybeStrings;\n" + // incompatible: T has a bound constrained to @NonNull
+ " p.X2<java.lang.@NonNull String> strings;\n" + // incompatible: W is constrained to @Nullable
+ " void test(p.X1<java.lang.@NonNull String> x) {\n" + // OK
+ " x.<Y1, java.lang.@NonNull Object>foo(this, new Object());\n" + // incompatible: V is constrained to @Nullable via superclass
+ " }\n" +
+ "}\n"
+ },
+ customOptions,
+ "----------\n" +
+ "1. ERROR in Y1.java (at line 3)\n" +
+ " p.X1<java.lang.@Nullable String> maybeStrings;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null constraint mismatch: The type \'@Nullable String\' is not a valid substitute for the type parameter \'T\' which is constrained as \'@NonNull\'\n" +
+ "----------\n" +
+ "2. ERROR in Y1.java (at line 4)\n" +
+ " p.X2<java.lang.@NonNull String> strings;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null constraint mismatch: The type \'@NonNull String\' is not a valid substitute for the type parameter \'W\' which is constrained as \'@Nullable\'\n" +
+ "----------\n" +
+ "3. ERROR in Y1.java (at line 6)\n" +
+ " x.<Y1, java.lang.@NonNull Object>foo(this, new Object());\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null constraint mismatch: The type '@NonNull Object' is not a valid substitute for the type parameter 'V' which is constrained as '@Nullable'\n" +
+ "----------\n"
+ );
+ }
+
// storing and decoding null-type-annotations to/from classfile: method with all kinds of type annotations
public void testBinary07() {
Map customOptions = getCompilerOptions();
@@ -1065,6 +1279,28 @@
Map customOptions = getCompilerOptions();
customOptions.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
customOptions.put(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION, JavaCore.IGNORE);
+ runNegativeTestWithLibs(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "import java.util.*;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public abstract class X1 {\n" +
+ " public class Inner {}\n" +
+ " public Object []@NonNull[] arrays(Object @NonNull[][] oa1) { return null; }\n" +
+ " public void nesting(@NonNull Inner i1, X1.@Nullable Inner i2) { }\n" +
+ " public void wildcard1(List<@Nullable ? extends @NonNull X1> l) { } // contradiction\n" +
+ " public void wildcard2(List<? super @NonNull X1> l) { }\n" +
+ "}\n"
+ },
+ customOptions,
+ "----------\n" +
+ "1. ERROR in p\\X1.java (at line 8)\n" +
+ " public void wildcard1(List<@Nullable ? extends @NonNull X1> l) { } // contradiction\n" +
+ " ^^^^^^^^\n" +
+ "This nullness annotation conflicts with a \'@Nullable\' annotation which is effective on the same type parameter \n" +
+ "----------\n");
+ // fix the error:
runConformTestWithLibs(
new String[] {
"p/X1.java",
@@ -1074,46 +1310,147 @@
"public abstract class X1 {\n" +
" public class Inner {}\n" +
" public Object []@NonNull[] arrays(Object @NonNull[][] oa1) { return null; }\n" +
- " public void nesting(@NonNull Inner i1, @NonNull X1.@Nullable Inner i2) { }\n" +
- " public void wildcard1(List<@Nullable ? extends @NonNull X1> l) { }\n" + // contradiction
+ " public void nesting(@NonNull Inner i1, X1.@Nullable Inner i2) { }\n" +
+ " public void wildcard1(List<@Nullable ? extends X1> l) { }\n" +
" public void wildcard2(List<? super @NonNull X1> l) { }\n" +
"}\n"
},
customOptions,
"");
-// FIXME(stephan): add desired error messages:
+
runNegativeTestWithLibs(
new String[] {
"Y1.java",
"import p.X1;\n" +
"import org.eclipse.jdt.annotation.*;\n" +
-// "import java.util.*;\n" +
+ "import java.util.*;\n" +
"public class Y1 {\n" +
" void test(X1 x) {\n" +
- " Object @NonNull[][] a = new Object[0][];\n" +
- " x.arrays(a)[0] = null;\n" + // illegal
- " x.nesting(null, null);\n" + // 1st null is illegal
-// " x.wildcard2(new ArrayList<@NonNull Object>());\n" +
+ " Object @NonNull[][] a = new Object[0][]; // unsafe\n" +
+ " x.arrays(a)[0] = null; // illegal\n" +
+ " x.nesting(null, null); // 1st null is illegal\n" +
+ " x.wildcard2(new ArrayList<@NonNull Object>());\n" +
+ " x.wildcard2(new ArrayList<@Nullable Object>()); // incompatible(1)\n" +
+ " x.wildcard1(new ArrayList<@NonNull X1>()); // incompatible(2)\n" +
" }\n" +
"}\n"
},
customOptions,
"----------\n" +
-// "1. ERROR in Y1.java (at line 5)\n" +
-// " X1<@Nullable String> maybeStrings;\n" +
-// " ^^^^^^^^^^^^^^^^\n" +
-// "Incompatible type argument ...\n" +
-// "----------\n" +
- "1. ERROR in Y1.java (at line 6)\n" +
- " x.arrays(a)[0] = null;\n" +
+ "1. WARNING in Y1.java (at line 6)\n" +
+ " Object @NonNull[][] a = new Object[0][]; // unsafe\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "Null type safety (type annotations): The expression of type \'Object[][]\' needs unchecked conversion to conform to \'Object @NonNull[] []\'\n" +
+ "----------\n" +
+ "2. ERROR in Y1.java (at line 7)\n" +
+ " x.arrays(a)[0] = null; // illegal\n" +
" ^^^^^^^^^^^^^^\n" +
"Null type mismatch: required \'Object @NonNull[]\' but the provided value is null\n" +
-// TODO(stephan): not reported due to Bug 414384 - [1.8] type annotation on abbreviated inner class is not marked as inner type
-// "----------\n" +
-// "3. ERROR in Y1.java (at line 8)\n" +
-// " x.nesting(null, null);\n" +
-// " ^^^^\n" +
-// "Null type mismatch: required \'@NonNull X1.Inner\' but the provided value is null\n" +
+ "----------\n" +
+ "3. ERROR in Y1.java (at line 8)\n" +
+ " x.nesting(null, null); // 1st null is illegal\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'X1.@NonNull Inner\' but the provided value is null\n" +
+ "----------\n" +
+ "4. ERROR in Y1.java (at line 10)\n" +
+ " x.wildcard2(new ArrayList<@Nullable Object>()); // incompatible(1)\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type mismatch (type annotations): required \'List<? super @NonNull X1>\' but this expression has type \'ArrayList<@Nullable Object>\', corresponding supertype is \'List<@Nullable Object>\'\n" +
+ "----------\n" +
+ "5. ERROR in Y1.java (at line 11)\n" +
+ " x.wildcard1(new ArrayList<@NonNull X1>()); // incompatible(2)\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type mismatch (type annotations): required \'List<@Nullable ? extends p.X1>\' but this expression has type \'ArrayList<@NonNull X1>\', corresponding supertype is \'List<@NonNull X1>\'\n" +
+ "----------\n");
+ }
+
+ // storing and decoding null-type-annotations to/from classfile: details
+ // variant: qualified references
+ public void testBinary08b() {
+ Map customOptions = getCompilerOptions();
+ customOptions.put(JavaCore.COMPILER_PB_POTENTIAL_NULL_REFERENCE, JavaCore.ERROR);
+ customOptions.put(JavaCore.COMPILER_PB_MISSING_SERIAL_VERSION, JavaCore.IGNORE);
+ runNegativeTestWithLibs(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public abstract class X1 {\n" +
+ " public class Inner {}\n" +
+ " public java.lang.Object []@NonNull[] arrays(java.lang.Object @NonNull[][] oa1) { return null; }\n" +
+ " public void nesting(@NonNull Inner i1, X1.@Nullable Inner i2) { }\n" +
+ " public void wildcard1(java.util.List<@Nullable ? extends p.@NonNull X1> l) { } // contradiction\n" +
+ " public void wildcard2(java.util.List<? super p.@NonNull X1> l) { }\n" +
+ "}\n"
+ },
+ customOptions,
+ "----------\n" +
+ "1. ERROR in p\\X1.java (at line 7)\n" +
+ " public void wildcard1(java.util.List<@Nullable ? extends p.@NonNull X1> l) { } // contradiction\n" +
+ " ^^^^^^^^\n" +
+ "This nullness annotation conflicts with a \'@Nullable\' annotation which is effective on the same type parameter \n" +
+ "----------\n");
+ // fix the error:
+ runConformTestWithLibs(
+ new String[] {
+ "p/X1.java",
+ "package p;\n" +
+ "import java.util.*;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public abstract class X1 {\n" +
+ " public class Inner {}\n" +
+ " public java.lang.Object []@NonNull[] arrays(java.lang.Object @NonNull[][] oa1) { return null; }\n" +
+ " public void nesting(@NonNull Inner i1, p.X1.@Nullable Inner i2) { }\n" +
+ " public void wildcard1(List<@Nullable ? extends p.X1> l) { }\n" +
+ " public void wildcard2(List<? super p.@NonNull X1> l) { }\n" +
+ "}\n"
+ },
+ customOptions,
+ "");
+
+ runNegativeTestWithLibs(
+ new String[] {
+ "Y1.java",
+ "import p.X1;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.*;\n" +
+ "public class Y1 {\n" +
+ " void test(X1 x) {\n" +
+ " java.lang.Object @NonNull[][] a = new java.lang.Object[0][]; // unsafe\n" +
+ " x.arrays(a)[0] = null; // illegal\n" +
+ " x.nesting(null, null); // 1st null is illegal\n" +
+ " x.wildcard2(new ArrayList<java.lang.@NonNull Object>());\n" +
+ " x.wildcard2(new ArrayList<java.lang.@Nullable Object>()); // incompatible(1)\n" +
+ " x.wildcard1(new ArrayList<p.@NonNull X1>()); // incompatible(2)\n" +
+ " }\n" +
+ "}\n"
+ },
+ customOptions,
+ "----------\n" +
+ "1. WARNING in Y1.java (at line 6)\n" +
+ " java.lang.Object @NonNull[][] a = new java.lang.Object[0][]; // unsafe\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type safety (type annotations): The expression of type \'Object[][]\' needs unchecked conversion to conform to \'Object @NonNull[] []\'\n" +
+ "----------\n" +
+ "2. ERROR in Y1.java (at line 7)\n" +
+ " x.arrays(a)[0] = null; // illegal\n" +
+ " ^^^^^^^^^^^^^^\n" +
+ "Null type mismatch: required \'Object @NonNull[]\' but the provided value is null\n" +
+ "----------\n" +
+ "3. ERROR in Y1.java (at line 8)\n" +
+ " x.nesting(null, null); // 1st null is illegal\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'X1.@NonNull Inner\' but the provided value is null\n" +
+ "----------\n" +
+ "4. ERROR in Y1.java (at line 10)\n" +
+ " x.wildcard2(new ArrayList<java.lang.@Nullable Object>()); // incompatible(1)\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type mismatch (type annotations): required \'List<? super @NonNull X1>\' but this expression has type \'ArrayList<@Nullable Object>\', corresponding supertype is \'List<@Nullable Object>\'\n" +
+ "----------\n" +
+ "5. ERROR in Y1.java (at line 11)\n" +
+ " x.wildcard1(new ArrayList<p.@NonNull X1>()); // incompatible(2)\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type mismatch (type annotations): required \'List<@Nullable ? extends p.X1>\' but this expression has type \'ArrayList<@NonNull X1>\', corresponding supertype is \'List<@NonNull X1>\'\n" +
"----------\n");
}
@@ -1498,4 +1835,696 @@
"----------\n");
}
+ // challenge parameterized type with partial substitution of super's type parameters
+ public void testCompatibility5() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import java.util.Map;\n" +
+ "\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "abstract public class X<Y> implements Map<@NonNull String,Y> {\n" +
+ " void foo(X<Object> x) {\n" +
+ " Map<@NonNull String, Object> m1 = x; // OK\n" +
+ " Map<@Nullable String, Object> m2 = x; // NOK\n" +
+ " }\n" +
+ "}"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " Map<@Nullable String, Object> m2 = x; // NOK\n" +
+ " ^\n" +
+ "Null type mismatch (type annotations): required \'Map<@Nullable String,Object>\' but this expression has type \'X<Object>\', corresponding supertype is \'Map<@NonNull String,Object>\'\n" +
+ "----------\n");
+ }
+
+ // challenge parameterized type with partial substitution of super's type parameters
+ public void testCompatibility6() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import java.util.Map;\n" +
+ "\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "\n" +
+ "abstract public class X<@Nullable Y> implements Map<@Nullable String,Y> {\n" +
+ " void foo(X<Object> x) {\n" +
+ " Map<@Nullable String, @Nullable Object> m1 = x; // OK\n" +
+ " Map<@Nullable String, @NonNull Object> m2 = x; // NOK\n" +
+ " }\n" +
+ "}"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " Map<@Nullable String, @NonNull Object> m2 = x; // NOK\n" +
+ " ^\n" +
+ "Null type mismatch (type annotations): required \'Map<@Nullable String,@NonNull Object>\' but this expression has type \'X<Object>\', corresponding supertype is \'Map<@Nullable String,@Nullable Object>\'\n" +
+ "----------\n");
+ }
+
+ // illegal for type declaration
+ public void testUnsupportedLocation01() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public @NonNull class X {}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 2)\n" +
+ " public @NonNull class X {}\n" +
+ " ^^^^^^^^\n" +
+ "The nullness annotation \'NonNull\' is not applicable at this location\n" +
+ "----------\n");
+ }
+
+ // illegal for enclosing class (locations: field, argument, return type, local
+ public void testUnsupportedLocation02() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " class Inner {}\n" +
+ " @NonNull X.Inner f;\n" +
+ " @NonNull X.Inner foo(@NonNull X.Inner arg) {\n" +
+ " @NonNull X.Inner local = arg;\n" +
+ " return local;\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " @NonNull X.Inner f;\n" +
+ " ^^^^^^^^\n" +
+ "The nullness annotation \'NonNull\' is not applicable at this location\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " @NonNull X.Inner foo(@NonNull X.Inner arg) {\n" +
+ " ^^^^^^^^\n" +
+ "The nullness annotation \'NonNull\' is not applicable at this location\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " @NonNull X.Inner foo(@NonNull X.Inner arg) {\n" +
+ " ^^^^^^^^\n" +
+ "The nullness annotation \'NonNull\' is not applicable at this location\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 6)\n" +
+ " @NonNull X.Inner local = arg;\n" +
+ " ^^^^^^^^\n" +
+ "The nullness annotation \'NonNull\' is not applicable at this location\n" +
+ "----------\n");
+ }
+
+ // illegal for cast & instanceof with scalar type
+ public void testUnsupportedLocation03() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " @NonNull X foo(X arg) {\n" +
+ " if (!(arg instanceof @NonNull X))\n" +
+ " return (@NonNull X)arg;\n" +
+ " return arg;\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 4)\n" +
+ " if (!(arg instanceof @NonNull X))\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The expression of type X is already an instance of type X\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " if (!(arg instanceof @NonNull X))\n" +
+ " ^^^^^^^^^^\n" +
+ "Nullness annotations are not applicable at this location \n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 5)\n" +
+ " return (@NonNull X)arg;\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "Null type safety: Unchecked cast from X to @NonNull X\n" +
+ "----------\n");
+ }
+
+ // illegal for cast & instanceof with complex type
+ public void testUnsupportedLocation04() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "p/X.java",
+ "package p;\n" +
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.*;\n" +
+ "public class X {\n" +
+ " List<@NonNull X> parameterized(List<X> arg) {\n" +
+ " if (!(arg instanceof List<@NonNull X>))\n" +
+ " return (java.util.List<@NonNull X>)arg;\n" +
+ " return arg;\n" +
+ " }\n" +
+ " X @NonNull[] arrays(X[] arg) {\n" +
+ " if (!(arg instanceof X @NonNull[]))\n" +
+ " return (p.X @NonNull[])arg;\n" +
+ " return arg;\n" +
+ " }\n" +
+ " ArrayList<@NonNull String> foo(List<@NonNull String> l) {\n" +
+ " return (ArrayList<@NonNull String>) l;\n" + // OK
+ " }" +
+ " ArrayList<@NonNull String> foo2(List<@NonNull String> l) {\n" +
+ " return (ArrayList<String>) l;\n" + // warn, TODO(stephan) with flow analysis (bug 415292) we might recover the original @NonNull...
+ " }" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in p\\X.java (at line 6)\n" +
+ " if (!(arg instanceof List<@NonNull X>))\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Cannot perform instanceof check against parameterized type List<X>. Use the form List<?> instead since further generic type information will be erased at runtime\n" +
+ "----------\n" +
+ "2. ERROR in p\\X.java (at line 6)\n" +
+ " if (!(arg instanceof List<@NonNull X>))\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "Nullness annotations are not applicable at this location \n" +
+ "----------\n" +
+ "3. WARNING in p\\X.java (at line 7)\n" +
+ " return (java.util.List<@NonNull X>)arg;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type safety: Unchecked cast from List<X> to List<@NonNull X>\n" +
+ "----------\n" +
+ "4. WARNING in p\\X.java (at line 11)\n" +
+ " if (!(arg instanceof X @NonNull[]))\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The expression of type X[] is already an instance of type X[]\n" +
+ "----------\n" +
+ "5. ERROR in p\\X.java (at line 11)\n" +
+ " if (!(arg instanceof X @NonNull[]))\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Nullness annotations are not applicable at this location \n" +
+ "----------\n" +
+ "6. WARNING in p\\X.java (at line 12)\n" +
+ " return (p.X @NonNull[])arg;\n" +
+ " ^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type safety: Unchecked cast from X[] to X @NonNull[]\n" +
+ "----------\n" +
+ "7. WARNING in p\\X.java (at line 18)\n" +
+ " return (ArrayList<String>) l;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type safety (type annotations): The expression of type \'ArrayList<String>\' needs unchecked conversion to conform to \'ArrayList<@NonNull String>\'\n" +
+ "----------\n");
+ }
+
+ // illegal for allocation expression
+ public void testUnsupportedLocation05() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " X x = new @NonNull X();\n" +
+ " class Inner {}\n" +
+ " Inner i = this.new @Nullable Inner();\n" +
+ " java.util.List<@NonNull String> s = new java.util.ArrayList<@NonNull String>();\n" + // OK
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " X x = new @NonNull X();\n" +
+ " ^^^^^^^^\n" +
+ "The nullness annotation \'NonNull\' is not applicable at this location\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " Inner i = this.new @Nullable Inner();\n" +
+ " ^^^^^^^^^\n" +
+ "The nullness annotation \'Nullable\' is not applicable at this location\n" +
+ "----------\n");
+ }
+
+ public void testForeach() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "import java.util.*;\n" +
+ "public class X {\n" +
+ " void foo(List<@NonNull String> nns) {\n" +
+ " for(String s1 : nns) {\n" +
+ " logMsg(s1);\n" +
+ " }\n" +
+ " for(String s2 : getStrings()) {\n" +
+ " logMsg(s2);\n" +
+ " }\n" +
+ " }\n" +
+ " Collection<@Nullable String> getStrings() { return null; }\n" +
+ " void logMsg(@NonNull String msg) { }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " logMsg(s2);\n" +
+ " ^^\n" +
+ "Null type mismatch: required \'@NonNull String\' but the provided value is inferred as @Nullable\n" +
+ "----------\n");
+ }
+
+ // missing return type should not cause NPE
+ public void testBug415850_01() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " @NonNull foo() {}\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " @NonNull foo() {}\n" +
+ " ^^^^^\n" +
+ "Return type for the method is missing\n" +
+ "----------\n");
+ }
+
+ // enum constant inside raw type: initialization must be recognized as conform to the implicitly @NonNull declaration
+ public void testBug415850_02(){
+ runConformTestWithLibs(
+ new String[] {
+ "Callable.java",
+ "interface Callable<T> {\n" +
+ " public enum Result {\n" +
+ " GOOD, BAD\n" +
+ " };\n" +
+ " public Result call(T arg);\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
+ // when mapping 1st parameter to method receiver, avoid AIOOBE in ReferenceExpression#resolveType(..)
+ public void testBug415850_03() throws Exception {
+ Map options = getCompilerOptions();
+ options.put(JavaCore.COMPILER_PB_DEPRECATION, JavaCore.IGNORE);
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.*;\n" +
+ "import java.util.Date;\n" +
+ "import static java.lang.annotation.ElementType.*; \n" +
+ "@Target(TYPE_USE)\n" +
+ "@interface Vernal {}\n" +
+ "interface I {\n" +
+ " int f(Date d);\n" +
+ "}\n" +
+ "class X {\n" +
+ " static void monitorTemperature(Object myObject) {\n" +
+ " I i = @Vernal Date::getDay;\n" +
+ " }\n" +
+ "}\n",
+ },
+ options,
+ "");
+ }
+
+ // ensure annotation type has super types connected, to avoid NPE in ImplicitNullAnnotationVerifier.collectOverriddenMethods(..)
+ public void testBug415850_04() throws Exception {
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "public class X implements @B @C('i') J { }",
+ "B.java",
+ "import java.lang.annotation.Target;\n" +
+ "import static java.lang.annotation.ElementType.*;\n" +
+ "import java.lang.annotation.Retention;\n" +
+ "import static java.lang.annotation.RetentionPolicy.*;\n" +
+ "@Target(TYPE_USE)\n" +
+ "@Retention(CLASS)\n" +
+ "@interface B {\n" +
+ " int value() default -1;\n" +
+ "}",
+ "C.java",
+ "import java.lang.annotation.Target;\n" +
+ "import static java.lang.annotation.ElementType.*;\n" +
+ "import java.lang.annotation.Retention;\n" +
+ "import static java.lang.annotation.RetentionPolicy.*;\n" +
+ "@Target(TYPE_USE)\n" +
+ "@Retention(RUNTIME)\n" +
+ "@interface C {\n" +
+ " char value() default '-';\n" +
+ "}\n",
+ "J.java",
+ "interface J {}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
+ // don't let type annotations on array dimensions spoil type compatibility
+ public void testBug415850_05() {
+ runNegativeTestWithLibs(
+ new String[]{
+ "X.java",
+ "import java.lang.annotation.Target;\n" +
+ "import static java.lang.annotation.ElementType.*;\n" +
+ "public class X {\n" +
+ " public void foo() {\n" +
+ " int @Marker [][][] i = new @Marker int @Marker [2] @Marker [@Marker bar()] @Marker [];\n" +
+ " }\n" +
+ " public int bar() {\n" +
+ " return 2;\n" +
+ " }\n" +
+ "}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker {}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " int @Marker [][][] i = new @Marker int @Marker [2] @Marker [@Marker bar()] @Marker [];\n" +
+ " ^^^^^^^\n" +
+ "Syntax error, type annotations are illegal here\n" +
+ "----------\n");
+ }
+
+ // don't let type annotations on array dimensions spoil type compatibility
+ // case without any error
+ public void testBug415850_06() {
+ runConformTestWithLibs(
+ new String[]{
+ "X.java",
+ "import java.lang.annotation.Target;\n" +
+ "public class X {\n" +
+ " public void foo() {\n" +
+ " int @Marker [][][] i = new @Marker int @Marker [2] @Marker [bar()] @Marker [];\n" +
+ " }\n" +
+ " public int bar() {\n" +
+ " return 2;\n" +
+ " }\n" +
+ "}\n" +
+ "@Target (java.lang.annotation.ElementType.TYPE_USE)\n" +
+ "@interface Marker {}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
+ public void testBug416172() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X {\n" +
+ " class Y {}\n" +
+ " X.@NonNull Y foo(X.@NonNull Y xy) {\n" +
+ " return new X().new Y();\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class Z extends X {\n" +
+ " @Override\n" +
+ " X.@NonNull Y foo(X.Y xy) {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. WARNING in X.java (at line 12)\n" +
+ " X.@NonNull Y foo(X.Y xy) {\n" +
+ " ^^^\n" +
+ "Missing non-null annotation: inherited method from X specifies this parameter as @NonNull\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 13)\n" +
+ " return null;\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'X.@NonNull Y\' but the provided value is null\n" +
+ "----------\n");
+ }
+
+ public void testBug416174() {
+ // FIXME(stephan): should report null spec violation
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import java.util.List;\n" +
+ "\n" +
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X {\n" +
+ " void foo(List<X> lx) {\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "class Z extends X {\n" +
+ " void foo(List<@NonNull X> xy) {\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. WARNING in X.java (at line 11)\n" +
+ " void foo(List<@NonNull X> xy) {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The method foo(List<X>) of type Z should be tagged with @Override since it actually overrides a superclass method\n" +
+ "----------\n");
+ }
+
+ public void testBug416175() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import java.util.ArrayList;\n" +
+ "import java.util.List;\n" +
+ "\n" +
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " List<@NonNull ? extends @NonNull String> ls = new ArrayList<String>();\n" +
+ " ls.add(null);\n" +
+ " @NonNull String s = ls.get(0);\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. WARNING in X.java (at line 8)\n" +
+ " List<@NonNull ? extends @NonNull String> ls = new ArrayList<String>();\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Null type safety (type annotations): The expression of type \'ArrayList<String>\' needs unchecked conversion to conform to \'List<@NonNull ? extends String>\'\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 9)\n" +
+ " ls.add(null);\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'@NonNull ? extends String\' but the provided value is null\n" +
+ "----------\n");
+ }
+
+ // original test (was throwing stack overflow)
+ public void testBug416176() {
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X<@NonNull T> {\n" +
+ " T foo(T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
+ // variant to challenge merging of annotation on type variable and its use
+ public void testBug416176a() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "import org.eclipse.jdt.annotation.Nullable;\n" +
+ "\n" +
+ "public class X<@NonNull T> {\n" +
+ " T foo(T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " @NonNull T bar1(@NonNull T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " @NonNull T bar2(@Nullable T t) { // contradiction: cannot make T @Nullable\n" +
+ " return t;\n" +
+ " }\n" +
+ " T bar3() {\n" +
+ " return null;\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. ERROR in X.java (at line 11)\n" +
+ " @NonNull T bar2(@Nullable T t) { // contradiction: cannot make T @Nullable\n" +
+ " ^^^^^^^^^\n" +
+ "Contradictory null specification; only one of @NonNull and @Nullable can be specified at any location\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 15)\n" +
+ " return null;\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'T\' but the provided value is null\n" +
+ "----------\n");
+ }
+
+ // variant to challenge duplicate methods, though with different parameter annotations
+ public void testBug416176b() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "import org.eclipse.jdt.annotation.Nullable;\n" +
+ "\n" +
+ "public class X<T> {\n" +
+ " @NonNull T bar(@NonNull T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " @NonNull T bar(@Nullable T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " @NonNull T bar(@NonNull T t) {\n" +
+ " ^^^^^^^^^^^^^^^^^\n" +
+ "Duplicate method bar(T) in type X<T>\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 8)\n" +
+ " @NonNull T bar(@Nullable T t) {\n" +
+ " ^^^^^^^^^^^^^^^^^^\n" +
+ "Duplicate method bar(T) in type X<T>\n" +
+ "----------\n");
+ }
+
+ public void testBug416180() {
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X<T> {\n" +
+ " T foo(T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " \n" +
+ " public static void main(String[] args) {\n" +
+ " X<String> x = new Y();\n" +
+ " }\n" +
+ "} \n" +
+ "\n" +
+ "class Y extends X<@NonNull String> {\n" +
+ " @Override\n" +
+ " @NonNull String foo(java.lang.@NonNull String t) {\n" +
+ " return \"\";\n" +
+ " };\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
+
+ public void testBug416181() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X<T> {\n" +
+ " class Y {\n" +
+ " \n" +
+ " }\n" +
+ " \n" +
+ " X<String>.@NonNull Y y = null; // 1st error here.\n" +
+ " \n" +
+ " @NonNull Y y2 = null; // 2nd error here.\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " X<String>.@NonNull Y y = null; // 1st error here.\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'X<String>.@NonNull Y\' but the provided value is null\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 10)\n" +
+ " @NonNull Y y2 = null; // 2nd error here.\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required \'X<T>.@NonNull Y\' but the provided value is null\n" +
+ "----------\n");
+ }
+
+ public void testBug416182() {
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "import org.eclipse.jdt.annotation.Nullable;\n" +
+ "\n" +
+ "public class X<T> {\n" +
+ " T foo(@NonNull T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " X<@Nullable String> xs = new X<String>();\n" +
+ " xs.foo(null);\n" +
+ " }\n" +
+ " \n" +
+ " public void test(X<String> x) {\n" +
+ " X<@Nullable String> xs = x;\n" +
+ " xs.bar(null);\n" +
+ " }\n" +
+ " public void bar(T t) {}\n" +
+ "\n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "----------\n" +
+ "1. WARNING in X.java (at line 9)\n" +
+ " X<@Nullable String> xs = new X<String>();\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "Null type safety (type annotations): The expression of type 'X<String>' needs unchecked conversion to conform to 'X<@Nullable String>'\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 10)\n" +
+ " xs.foo(null);\n" +
+ " ^^^^\n" +
+ "Null type mismatch: required '@NonNull String' but the provided value is null\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 14)\n" +
+ " X<@Nullable String> xs = x;\n" +
+ " ^\n" +
+ "Null type safety (type annotations): The expression of type \'X<String>\' needs unchecked conversion to conform to \'X<@Nullable String>\'\n" +
+ "----------\n");
+ }
+
+ public void testBug416183() {
+ runConformTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X<T> {\n" +
+ " T foo(@NonNull T t) {\n" +
+ " return t;\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " X<String> xs = new X<String>();\n" +
+ " xs.foo(\"\");\n" +
+ " }\n" +
+ " \n" +
+ "}\n"
+ },
+ getCompilerOptions(),
+ "");
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java
index 0c85191..dd1403a 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java
@@ -16,6 +16,11 @@
* Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
* Bug 409246 - [1.8][compiler] Type annotations on catch parameters not handled properly
* Bug 409517 - [1.8][compiler] Type annotation problems on more elaborate array references
+ * Stephan Herrmann - Contribution for
+ * Bug 415911 - [1.8][compiler] NPE when TYPE_USE annotated method with missing return type
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
+ * Jesper S Moller - Contributions for
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
@@ -30,6 +35,7 @@
static {
// TESTS_NUMBERS = new int [] { 40 };
+// TESTS_NAMES = new String[] { "testTypeVariable" };
}
public static Class testClass() {
return TypeAnnotationTest.class;
@@ -3211,7 +3217,7 @@
"");
String expectedOutput =
" RuntimeVisibleTypeAnnotations: \n" +
- " #48 @A(\n" +
+ " #47 @A(\n" +
" target type = 0x46 METHOD_REFERENCE\n" +
" offset = 8\n" +
" )\n";
@@ -3243,14 +3249,14 @@
"");
String expectedOutput =
" RuntimeVisibleTypeAnnotations: \n" +
- " #31 @B(\n" +
- " #32 value=(int) 1 (constant type)\n" +
+ " #30 @B(\n" +
+ " #31 value=(int) 1 (constant type)\n" +
" target type = 0x46 METHOD_REFERENCE\n" +
" offset = 0\n" +
" location = [ARRAY]\n" +
" )\n" +
- " #31 @B(\n" +
- " #32 value=(int) 2 (constant type)\n" +
+ " #30 @B(\n" +
+ " #31 value=(int) 2 (constant type)\n" +
" target type = 0x46 METHOD_REFERENCE\n" +
" offset = 0\n" +
" )\n";
@@ -3285,7 +3291,7 @@
"");
String expectedOutput =
" RuntimeVisibleTypeAnnotations: \n" +
- " #54 @A(\n" +
+ " #53 @A(\n" +
" target type = 0x4a CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT\n" +
" offset = 8\n" +
" type argument index = 0\n" +
@@ -3320,7 +3326,7 @@
"");
String expectedOutput =
" RuntimeVisibleTypeAnnotations: \n" +
- " #48 @A(\n" +
+ " #47 @A(\n" +
" target type = 0x4b METHOD_REFERENCE_TYPE_ARGUMENT\n" +
" offset = 8\n" +
" type argument index = 0\n" +
@@ -5465,7 +5471,46 @@
" )\n";
checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput, ClassFileBytesDisassembler.SYSTEM);
}
-
-
+
+ public void testBug415911() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "import java.lang.annotation.ElementType;\n" +
+ "import java.lang.annotation.Target;\n" +
+ "\n" +
+ "@Target(ElementType.TYPE_USE)\n" +
+ "@interface Marker {\n" +
+ "}\n" +
+ "\n" +
+ "public class X {\n" +
+ " @Marker\n" +
+ " foo(String s) {\n" +
+ "\n" +
+ " }\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 10)\n" +
+ " foo(String s) {\n" +
+ " ^^^^^^^^^^^^^\n" +
+ "Return type for the method is missing\n" +
+ "----------\n");
+ }
+
+ public void testTypeVariable() {
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X<@Missing T> {\n" +
+ "}\n"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 1)\n" +
+ " public class X<@Missing T> {\n" +
+ " ^^^^^^^\n" +
+ "Missing cannot be resolved to a type\n" +
+ "----------\n");
+ }
}
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index 0a1ae8e..d4fc9c7 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>eclipse.jdt.core</groupId>
- <version>4.4.0-SNAPSHOT</version>
+ <version>4.3.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core.tests.model</artifactId>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java
index 76c0c20..29437ff 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java
@@ -444,7 +444,7 @@
requestor.getResults());
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44984
-public void test0010() throws JavaModelException {
+public void _test0010() throws JavaModelException {
this.workingCopies = new ICompilationUnit[2];
this.workingCopies[0] = getWorkingCopy(
"/Completion/src/test/Test.java",
diff --git a/org.eclipse.jdt.core/.options b/org.eclipse.jdt.core/.options
index 3a18809..83d4c30 100644
--- a/org.eclipse.jdt.core/.options
+++ b/org.eclipse.jdt.core/.options
@@ -22,13 +22,13 @@
# Reports failures during classpath variable initialization, and classpath container resolution
org.eclipse.jdt.core/debug/cpresolution/failure=false
-# Reports bad node nesting in DOM AST
+# Reports bad node nesting in DOM AST (for interactive usage)
org.eclipse.jdt.core/debug/dom/ast=false
-# Throws an exception in case of bad node nesting in DOM AST
+# Throws an exception in case of bad node nesting in DOM AST (enabled in tests)
org.eclipse.jdt.core/debug/dom/ast/throw=false
-# Reports type errors when using ASTRewrite
+# Reports type errors when using ASTRewrite (throws exceptions; not enabled by default, since some non-typesafe operations are fine in practice)
org.eclipse.jdt.core/debug/dom/rewrite=false
# Report type hierarchy connections, refreshes and deltas
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
new file mode 100644
index 0000000..8268b00
--- /dev/null
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?><component id="org.eclipse.jdt.core" version="2">
+ <resource path="META-INF/MANIFEST.MF">
+ <filter comment="BETA_JAVA8" id="924844039">
+ <message_arguments>
+ <message_argument value="3.9.1"/>
+ <message_argument value="3.9.0"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index a261eed..0d867d8 100644
--- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.10.0.v_OTDT_r230_qualifier
+Bundle-Version: 3.9.1.v_OTDT_r230_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/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index e6cc332..6512cd0 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
@@ -27,8 +27,8 @@
### compiler
#Format: compiler.name = word1 word2 word3
compiler.name = Eclipse Compiler for Java(TM)
-#Format: compiler.version = (The placeholder 'bundle_qualifier' will be automatically filled. Do not remove or alter it)
-compiler.version = bundle_qualifier, 3.10.0
+#Format: compiler.version = (The placeholder 'bundle_qualifier,' will be automatically filled via pom.xml. Do not remove or alter it)
+compiler.version = bundle_qualifier, 3.9.1 BETA_JAVA8
compiler.copyright = Copyright IBM Corp 2000, 2013. All rights reserved.
###{ObjectTeams:
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 17db9f8..8922355 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
@@ -163,7 +163,9 @@
* ArrayReferencePotentialNullReference
* DereferencingNullableExpression
* NullityMismatchingTypeAnnotation
+ * NullityMismatchingTypeAnnotationSuperHint
* NullityUncheckedTypeAnnotationDetail
+ * NullityUncheckedTypeAnnotationDetailSuperHint
* NullableFieldReference
* UninitializedNonNullField
* UninitializedNonNullFieldHintMissingDefault
@@ -196,7 +198,10 @@
* PotentialNullExpressionReference
* RedundantNullCheckAgainstNonNullType
* NullAnnotationUnsupportedLocation
+ * NullAnnotationUnsupportedLocationAtType
* NullityMismatchTypeArgument
+ * ContradictoryNullAnnotationsOnBound
+ * UnsafeNullnessCast
* Jesper S Moller - added the following constants
* TargetTypeNotAFunctionalInterface
* OuterLocalMustBeEffectivelyFinal
@@ -445,7 +450,7 @@
int DuplicateBlankFinalFieldInitialization = FieldRelated + 82;
/** @since 3.6 */
int UnresolvedVariable = FieldRelated + 83;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int NonStaticOrAlienTypeReceiver = MethodRelated + 84;
// variable hiding
/** @since 3.0 */
@@ -462,11 +467,11 @@
int ArgumentHidingField = Internal + 95;
/** @since 3.1 */
int MissingSerialVersion = Internal + 96;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int LambdaRedeclaresArgument = Internal + 97;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int LambdaRedeclaresLocal = Internal + 98;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int LambdaDescriptorMentionsUnmentionable = 99;
// methods
@@ -498,17 +503,17 @@
int MethodCanBeStatic = Internal + MethodRelated + 121;
/** @since 3.7 */
int MethodCanBePotentiallyStatic = Internal + MethodRelated + 122;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int MethodReferenceSwingsBothWays = Internal + MethodRelated + 123;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int StaticMethodShouldBeAccessedStatically = Internal + MethodRelated + 124;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int InvalidArrayConstructorReference = Internal + MethodRelated + 125;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ConstructedArrayIncompatible = Internal + MethodRelated + 126;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DanglingReference = Internal + MethodRelated + 127;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IncompatibleMethodReference = Internal + MethodRelated + 128;
// constructors
@@ -941,7 +946,7 @@
/** @since 3.2 */
int EnumConstantsCannotBeSurroundedByParenthesis = Syntax + Internal + 442;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalUseOfUnderscoreAsAnIdentifier = Syntax + Internal + 443;
// detected task
/** @since 2.1 */
@@ -1369,51 +1374,51 @@
int UnusedWarningToken = Internal + 635;
/** @since 3.6 */
int MissingOverrideAnnotationForInterfaceMethodImplementation = MethodRelated + 636;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int InvalidUsageOfTypeAnnotations = Syntax + Internal + 637;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DisallowedExplicitThisParameter = Syntax + Internal + 638;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int MisplacedTypeAnnotations = Syntax + Internal + 639;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalTypeAnnotationsInStaticMemberAccess = Internal + Syntax + 640;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalUsageOfTypeAnnotations = Internal + Syntax + 641;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalDeclarationOfThisParameter = Internal + Syntax + 642;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ExplicitThisParameterNotBelow18 = Internal + Syntax + 643;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DefaultMethodNotBelow18 = Internal + Syntax + 644;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int LambdaExpressionNotBelow18 = Internal + Syntax + 645;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int MethodReferenceNotBelow18 = Internal + Syntax + 646;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ConstructorReferenceNotBelow18 = Internal + Syntax + 647;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ExplicitThisParameterNotInLambda = Internal + Syntax + 648;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ExplicitAnnotationTargetRequired = TypeRelated + 649;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalTypeForExplicitThis = Internal + Syntax + 650;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalQualifierForExplicitThis = Internal + Syntax + 651;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalQualifierForExplicitThis2 = Internal + Syntax + 652;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int TargetTypeNotAFunctionalInterface = Internal + TypeRelated + 653;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalVarargInLambda = Internal + TypeRelated + 654;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int illFormedParameterizationOfFunctionalInterface = Internal + TypeRelated + 655;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int lambdaSignatureMismatched = Internal + TypeRelated + 656;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int lambdaParameterTypeMismatched = Internal + TypeRelated + 657;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IncompatibleLambdaParameterType = Internal + TypeRelated + 658;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int NoGenericLambda = Internal + TypeRelated + 659;
/**
* More problems in generics
@@ -1424,11 +1429,11 @@
int UnusedTypeParameter = TypeRelated + 661;
/** @since 3.9 */
int IllegalArrayOfUnionType = TypeRelated + 662;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int OuterLocalMustBeEffectivelyFinal = Internal + 663;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int InterfaceNotFunctionalInterface = Internal + TypeRelated + 664;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ConstructionTypeMismatch = Internal + TypeRelated + 665;
@@ -1604,17 +1609,17 @@
int ExplicitlyClosedAutoCloseable = Internal + 889;
/** @since 3.8 */
int SwitchOnEnumNotBelow15 = TypeRelated + 890; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=360317
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IntersectionCastNotBelow18 = TypeRelated + 891;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalBasetypeInIntersectionCast = TypeRelated + 892;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalArrayTypeInIntersectionCast = TypeRelated + 893;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DuplicateBoundInIntersectionCast = TypeRelated + 894;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int MultipleFunctionalInterfaces = TypeRelated + 895;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int StaticInterfaceMethodNotBelow18 = Internal + Syntax + 896;
/**
@@ -1682,60 +1687,70 @@
int ConflictingNullAnnotations = MethodRelated + 939;
/** @since 3.9 */
int ConflictingInheritedNullAnnotations = MethodRelated + 940;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int RedundantNullCheckOnField = Internal + 941;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int FieldComparisonYieldsFalse = Internal + 942;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int ArrayReferencePotentialNullReference = Internal + 951;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DereferencingNullableExpression = Internal + 952;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int NullityMismatchingTypeAnnotation = Internal + 953;
- /** @since 3.10 BETA_JAVA8 */
- int NullityUncheckedTypeAnnotationDetail = Internal + 954;
- /** @since 3.10 BETA_JAVA8 */
- int ReferenceExpressionParameterMismatchPromisedNullable = MethodRelated + 955;
- /** @since 3.10 BETA_JAVA8 */
- int ReferenceExpressionParameterRequiredNonnullUnchecked = MethodRelated + 956;
- /** @since 3.10 BETA_JAVA8 */
- int ReferenceExpressionReturnNullRedef = MethodRelated + 957;
- /** @since 3.10 BETA_JAVA8 */
- int ReferenceExpressionReturnNullRedefUnchecked = MethodRelated + 958;
- /** @since 3.10 BETA_JAVA8 */
- int RedundantNullCheckAgainstNonNullType = Internal + 959;
- /** @since 3.10 BETA_JAVA8 */
- int NullAnnotationUnsupportedLocation = Internal + 960;
- /** @since 3.10 BETA_JAVA8 */
- int NullityMismatchTypeArgument = Internal + 961;
+ /** @since 3.9 BETA_JAVA8 */
+ int NullityMismatchingTypeAnnotationSuperHint = Internal + 954;
+ /** @since 3.9 BETA_JAVA8 */
+ int NullityUncheckedTypeAnnotationDetail = Internal + 955;
+ /** @since 3.9 BETA_JAVA8 */
+ int NullityUncheckedTypeAnnotationDetailSuperHint = Internal + 956;
+ /** @since 3.9 BETA_JAVA8 */
+ int ReferenceExpressionParameterMismatchPromisedNullable = MethodRelated + 957;
+ /** @since 3.9 BETA_JAVA8 */
+ int ReferenceExpressionParameterRequiredNonnullUnchecked = MethodRelated + 958;
+ /** @since 3.9 BETA_JAVA8 */
+ int ReferenceExpressionReturnNullRedef = MethodRelated + 959;
+ /** @since 3.9 BETA_JAVA8 */
+ int ReferenceExpressionReturnNullRedefUnchecked = MethodRelated + 960;
+ /** @since 3.9 BETA_JAVA8 */
+ int RedundantNullCheckAgainstNonNullType = Internal + 961;
+ /** @since 3.9 BETA_JAVA8 */
+ int NullAnnotationUnsupportedLocation = Internal + 962;
+ /** @since 3.9 BETA_JAVA8 */
+ int NullAnnotationUnsupportedLocationAtType = Internal + 963;
+ /** @since 3.9 BETA_JAVA8 */
+ int NullityMismatchTypeArgument = Internal + 964;
+ /** @since 3.9 BETA_JAVA8 */
+ int ContradictoryNullAnnotationsOnBound = Internal + 965;
+ /** @since 3.9 BETA_JAVA8 */
+ int UnsafeNullnessCast = Internal + 966;
// Java 8 work
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalModifiersForElidedType = Internal + 1001;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalModifiers = Internal + 1002;
// default methods:
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalModifierForInterfaceMethod18 = MethodRelated + 1050;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DefaultMethodOverridesObjectMethod = MethodRelated + 1051;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int InheritedDefaultMethodConflictsWithOtherInherited = MethodRelated + 1052;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int DuplicateInheritedDefaultMethods = MethodRelated + 1053;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int SuperAccessCannotBypassDirectSuper = TypeRelated + 1054;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int SuperCallCannotBypassOverride = MethodRelated + 1055;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalModifierCombinationForInterfaceMethod = MethodRelated + 1056;
- /** @since 3.10 BETA_JAVA8 */
+ /** @since 3.9 BETA_JAVA8 */
int IllegalStrictfpForAbstractInterfaceMethod = MethodRelated + 1057;
/**
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 ef974bd..437afbb 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
@@ -15,6 +15,8 @@
* Technical University Berlin - extended API and implementation
* Jesper S Moller - Contributions for
* Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335
+ * Bug 406982 - [1.8][compiler] Generation of MethodParameters Attribute in classfile
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
@@ -311,6 +313,9 @@
if (this.targetJDK >= ClassFileConstants.JDK1_8) {
this.produceAttributes |= ClassFileConstants.ATTR_TYPE_ANNOTATION;
this.codeStream = new TypeAnnotationCodeStream(this);
+ if (options.produceMethodParameters) {
+ this.produceAttributes |= ClassFileConstants.ATTR_METHOD_PARAMETERS;
+ }
} else {
this.codeStream = new StackMapFrameCodeStream(this);
}
@@ -1078,6 +1083,9 @@
.compilationResult
.getLineSeparatorPositions());
// update the number of attributes
+ if ((this.produceAttributes & ClassFileConstants.ATTR_METHOD_PARAMETERS) != 0) {
+ attributeNumber += generateMethodParameters(methodBinding);
+ }
this.contents[methodAttributeOffset++] = (byte) (attributeNumber >> 8);
this.contents[methodAttributeOffset] = (byte) attributeNumber;
}
@@ -2233,6 +2241,9 @@
invisibleTypeAnnotationsCounter);
}
}
+ if ((this.produceAttributes & ClassFileConstants.ATTR_METHOD_PARAMETERS) != 0) {
+ attributesNumber += generateMethodParameters(binding);
+ }
// update the number of attributes
this.contents[methodAttributeOffset++] = (byte) (attributesNumber >> 8);
this.contents[methodAttributeOffset] = (byte) attributesNumber;
@@ -2971,7 +2982,7 @@
this.contents[localContentsOffset++] = 0;
this.contents[localContentsOffset++] = (byte) 3;
- int functionalDescriptorIndex = this.constantPool.literalIndexForMethodHandle(functional.descriptor.original());
+ int functionalDescriptorIndex = this.constantPool.literalIndexForMethodType(functional.descriptor.original().signature());
this.contents[localContentsOffset++] = (byte) (functionalDescriptorIndex >> 8);
this.contents[localContentsOffset++] = (byte) functionalDescriptorIndex;
@@ -3876,6 +3887,120 @@
return attributesNumber;
}
+ /**
+ * @param binding the given method binding
+ * @return the number of attributes created while dumping he method's parameters in the .class file (0 or 1)
+ */
+ private int generateMethodParameters(final MethodBinding binding) {
+
+ int initialContentsOffset = this.contentsOffset;
+ int length = 0; // count of actual parameters
+
+ AbstractMethodDeclaration methodDeclaration = binding.sourceMethod();
+
+ boolean isConstructor = binding.isConstructor();
+ TypeBinding[] targetParameters = binding.parameters;
+ ReferenceBinding declaringClass = binding.declaringClass;
+
+ if (declaringClass.isEnum()) {
+ if (isConstructor) { // insert String name,int ordinal
+ length = writeArgumentName(ConstantPool.EnumName, ClassFileConstants.AccSynthetic, length);
+ length = writeArgumentName(ConstantPool.EnumOrdinal, ClassFileConstants.AccSynthetic, length);
+ } else if (CharOperation.equals(ConstantPool.ValueOf, binding.selector)) { // insert String name
+ length = writeArgumentName(ConstantPool.Name, ClassFileConstants.AccMandated, length);
+ targetParameters = Binding.NO_PARAMETERS; // Override "unknown" synthetics below
+ }
+ }
+
+ boolean needSynthetics = isConstructor && declaringClass.isNestedType();
+ if (needSynthetics) {
+ // Take into account the synthetic argument names
+ // This tracks JLS8, paragraph 8.8.9
+ boolean anonymousWithLocalSuper = declaringClass.isAnonymousType() && declaringClass.superclass().isLocalType();
+ boolean anonymousWithNestedSuper = declaringClass.isAnonymousType() && declaringClass.superclass().isNestedType();
+ boolean isImplicitlyDeclared = ((! declaringClass.isPrivate()) || declaringClass.isAnonymousType()) && !anonymousWithLocalSuper;
+ ReferenceBinding[] syntheticArgumentTypes = declaringClass.syntheticEnclosingInstanceTypes();
+ if (syntheticArgumentTypes != null) {
+ for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
+ // This behaviour tracks JLS 15.9.5.1
+ // This covers that the parameter ending up in a nested class must be mandated "on the way in", even if it
+ // isn't the first. The practical relevance of this is questionable, since the constructor call will be
+ // generated by the same constructor.
+ boolean couldForwardToMandated = anonymousWithNestedSuper ? declaringClass.superclass().enclosingType().equals(syntheticArgumentTypes[i]) : true;
+ int modifier = couldForwardToMandated && isImplicitlyDeclared ? ClassFileConstants.AccMandated : ClassFileConstants.AccSynthetic;
+ char[] name = CharOperation.concat(
+ TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX,
+ String.valueOf(i).toCharArray()); // cannot use depth, can be identical
+ length = writeArgumentName(name, modifier | ClassFileConstants.AccFinal, length);
+ }
+ }
+ if (binding instanceof SyntheticMethodBinding) {
+ targetParameters = ((SyntheticMethodBinding)binding).targetMethod.parameters;
+ methodDeclaration = ((SyntheticMethodBinding)binding).targetMethod.sourceMethod();
+ }
+ }
+ if (targetParameters != Binding.NO_PARAMETERS) {
+ for (int i = 0, max = targetParameters.length; i < max; i++) {
+ if (methodDeclaration != null && methodDeclaration.arguments != null && methodDeclaration.arguments.length > i && methodDeclaration.arguments[i] != null) {
+ Argument argument = methodDeclaration.arguments[i];
+ length = writeArgumentName(argument.name, argument.binding.modifiers, length);
+ } else {
+ length = writeArgumentName(null, ClassFileConstants.AccSynthetic, length);
+ }
+ }
+ }
+ if (needSynthetics) {
+ SyntheticArgumentBinding[] syntheticOuterArguments = declaringClass.syntheticOuterLocalVariables();
+ int count = syntheticOuterArguments == null ? 0 : syntheticOuterArguments.length;
+ for (int i = 0; i < count; i++) {
+ length = writeArgumentName(syntheticOuterArguments[i].name, syntheticOuterArguments[i].modifiers | ClassFileConstants.AccSynthetic, length);
+ }
+ // move the extra padding arguments of the synthetic constructor invocation to the end
+ for (int i = targetParameters.length, extraLength = binding.parameters.length; i < extraLength; i++) {
+ TypeBinding parameter = binding.parameters[i];
+ length = writeArgumentName(parameter.constantPoolName(), ClassFileConstants.AccSynthetic, length);
+ }
+ }
+
+ if (length > 0) {
+ // so we actually output the parameter
+ int attributeLength = 1 + 4 * length; // u1 for count, u2+u2 per parameter
+ if (this.contentsOffset + 6 + attributeLength >= this.contents.length) {
+ resizeContents(6 + attributeLength);
+ }
+ int methodParametersNameIndex = this.constantPool.literalIndex(AttributeNamesConstants.MethodParametersName);
+ this.contents[initialContentsOffset++] = (byte) (methodParametersNameIndex >> 8);
+ this.contents[initialContentsOffset++] = (byte) methodParametersNameIndex;
+ this.contents[initialContentsOffset++] = (byte) (attributeLength >> 24);
+ this.contents[initialContentsOffset++] = (byte) (attributeLength >> 16);
+ this.contents[initialContentsOffset++] = (byte) (attributeLength >> 8);
+ this.contents[initialContentsOffset++] = (byte) attributeLength;
+ this.contents[initialContentsOffset++] = (byte) length;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+ private int writeArgumentName(char[] name, int modifiers, int oldLength) {
+ int ensureRoomForBytes = 4;
+ if (oldLength == 0) {
+ // Make room for
+ ensureRoomForBytes += 7;
+ this.contentsOffset += 7; // Make room for attribute header + count byte
+ }
+ if (this.contentsOffset + ensureRoomForBytes > this.contents.length) {
+ resizeContents(ensureRoomForBytes);
+ }
+ int parameterNameIndex = name == null ? 0 : this.constantPool.literalIndex(name);
+ this.contents[this.contentsOffset++] = (byte) (parameterNameIndex >> 8);
+ this.contents[this.contentsOffset++] = (byte) parameterNameIndex;
+ int flags = modifiers & (ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic | ClassFileConstants.AccMandated);
+ this.contents[this.contentsOffset++] = (byte) (flags >> 8);
+ this.contents[this.contentsOffset++] = (byte) flags;
+ return oldLength + 1;
+ }
+
private int generateSignatureAttribute(char[] genericSignature) {
int localContentsOffset = this.contentsOffset;
if (localContentsOffset + 8 >= this.contents.length) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
index 20069be..79a4b6d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java
@@ -22,7 +22,9 @@
* bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* bug 388281 - [compiler][null] inheritance of null annotations as an option
* bug 401030 - [1.8][null] Null analysis support for lambda methods.
- * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 403216 - [1.8][null] TypeReference#captureTypeAnnotations treats type annotations as type argument annotations
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -871,7 +873,7 @@
this.receiver.qualifyingName = null;
}
- if (enclosingReceiver != resolvedReceiverType) {
+ if (enclosingReceiver != resolvedReceiverType.unannotated()) {
this.scope.problemReporter().illegalTypeForExplicitThis(this.receiver, enclosingReceiver);
this.receiver = null;
}
@@ -977,15 +979,16 @@
if (this.binding.parameterNonNullness[i] != null) {
long nullAnnotationTagBit = this.binding.parameterNonNullness[i].booleanValue()
? TagBits.AnnotationNonNull : TagBits.AnnotationNullable;
- this.scope.validateNullAnnotation(nullAnnotationTagBit, this.arguments[i].type, this.arguments[i].annotations);
+ if (!this.scope.validateNullAnnotation(nullAnnotationTagBit, this.arguments[i].type, this.arguments[i].annotations))
+ this.binding.parameterNonNullness[i] = null;
}
}
}
} else {
int length = this.binding.parameters.length;
for (int i=0; i<length; i++) {
- long nullAnnotationTagBit = this.binding.parameters[i].tagBits & TagBits.AnnotationNullMASK;
- this.scope.validateNullAnnotation(nullAnnotationTagBit, this.arguments[i].type, this.arguments[i].annotations);
+ if (!this.scope.validateNullAnnotation(this.binding.parameters[i].tagBits, this.arguments[i].type, this.arguments[i].annotations))
+ this.binding.parameters[i] = this.binding.parameters[i].unannotated();
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
index c973703..187ef9b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java
@@ -26,6 +26,7 @@
* Andy Clement - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
* Jesper S Moller <jesper@selskabet.org> - Contributions for
* bug 378674 - "The method can be declared as static" is wrong
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
@@ -365,6 +366,7 @@
this.type.bits |= IsAllocationType;
// SH}
this.resolvedType = this.type.resolveType(scope, true /* check bounds*/);
+ this.resolvedType = checkIllegalNullAnnotation(scope, this.resolvedType);
checkParameterizedAllocation: {
if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
ReferenceBinding currentType = (ReferenceBinding)this.resolvedType;
@@ -587,6 +589,23 @@
return allocationType;
}
+/**
+ * Check if 'allocationType' illegally has a top-level null annotation.
+ * If so: report an error and return the unannotated variant.
+ */
+TypeBinding checkIllegalNullAnnotation(BlockScope scope, TypeBinding allocationType) {
+ if (allocationType != null) {
+ // only check top-level null annotation (annots on details are OK):
+ long nullTagBits = allocationType.tagBits & TagBits.AnnotationNullMASK;
+ if (nullTagBits != 0) {
+ Annotation annotation = this.type.findAnnotation(nullTagBits);
+ scope.problemReporter().nullAnnotationUnsupportedLocation(annotation);
+ return allocationType.unannotated();
+ }
+ }
+ return allocationType;
+}
+
public TypeBinding[] inferElidedTypes(ReferenceBinding allocationType, ReferenceBinding enclosingType, TypeBinding[] argumentTypes, final BlockScope scope) {
/* Given the allocation type and the arguments to the constructor, see if we can synthesize a generic static factory
method that would, given the argument types and the invocation site, manufacture a parameterized object of type allocationType.
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
index d4a7039..fc437bb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java
@@ -19,6 +19,8 @@
* bug 331649 - [compiler][null] consider null annotations for fields
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409517 - [1.8][compiler] Type annotation problems on more elaborate array references
@@ -544,7 +546,6 @@
}
final static MemberValuePair[] NoValuePairs = new MemberValuePair[0];
- private static final long TAGBITS_NULLABLE_OR_NONNULL = TagBits.AnnotationNullable|TagBits.AnnotationNonNull;
static final int[] TYPE_PATH_ELEMENT_ARRAY = new int[]{0,0};
static final int[] TYPE_PATH_INNER_TYPE = new int[]{1,0};
@@ -1024,18 +1025,18 @@
}
// fields don't yet have their type resolved, in 1.8 null annotations
// will be transfered from the field to its type during STB.resolveTypeFor().
- if ((sourceField.tagBits & TAGBITS_NULLABLE_OR_NONNULL) == TAGBITS_NULLABLE_OR_NONNULL) {
+ if ((sourceField.tagBits & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK) {
scope.problemReporter().contradictoryNullAnnotations(this);
- sourceField.tagBits &= ~TAGBITS_NULLABLE_OR_NONNULL; // avoid secondary problems
+ sourceField.tagBits &= ~TagBits.AnnotationNullMASK; // avoid secondary problems
}
break;
case Binding.LOCAL :
LocalVariableBinding variable = (LocalVariableBinding) this.recipient;
if (scope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8) {
variable.tagBits |= tagBits;
- if ((variable.tagBits & TAGBITS_NULLABLE_OR_NONNULL) == TAGBITS_NULLABLE_OR_NONNULL) {
+ if ((variable.tagBits & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK) {
scope.problemReporter().contradictoryNullAnnotations(this);
- variable.tagBits &= ~TAGBITS_NULLABLE_OR_NONNULL; // avoid secondary problems
+ variable.tagBits &= ~TagBits.AnnotationNullMASK; // avoid secondary problems
}
} else if (variable.type != null) {
// bits not relating to null analysis go into the variable:
@@ -1045,11 +1046,14 @@
if (nullTagBits != 0) {
if (variable.type.isBaseType()) {
scope.problemReporter().illegalAnnotationForBaseType(this, variable.type);
- } else {
- variable.type = scope.environment().pushAnnotationIntoType(variable.type, variable.declaration.type, nullTagBits);
- if ((variable.type.tagBits & TAGBITS_NULLABLE_OR_NONNULL) == TAGBITS_NULLABLE_OR_NONNULL) {
+ } else if (variable.declaration.type instanceof QualifiedTypeReference) {
+ scope.problemReporter().nullAnnotationUnsupportedLocation(this);
+ } else if (nullTagBits != (variable.type.tagBits & TagBits.AnnotationNullMASK)) {
+ if (((variable.type.tagBits & TagBits.AnnotationNullMASK) | nullTagBits ) == TagBits.AnnotationNullMASK) {
scope.problemReporter().contradictoryNullAnnotations(this);
variable.type = variable.type.unannotated();
+ } else {
+ variable.type = scope.environment().createAnnotatedType(variable.type, nullTagBits);
}
}
}
@@ -1184,7 +1188,7 @@
return this.resolvedType;
}
private boolean isTypeUseCompatible(TypeReference reference, Scope scope) {
- if (!(reference instanceof SingleTypeReference)) {
+ if (reference != null && !(reference instanceof SingleTypeReference)) {
Binding binding = scope.getPackage(reference.getTypeName());
// In case of ProblemReferenceBinding, don't report additional error
if (binding instanceof PackageBinding) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
index c2f1037..f06335b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java
@@ -31,6 +31,7 @@
* bug 383368 - [compiler][null] syntactic null analysis for field references
* bug 402993 - [null] Follow up of bug 401088: Missing warning about redundant null check
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -128,7 +129,7 @@
if (compilerOptions.isAnnotationBasedNullAnalysisEnabled) {
VariableBinding var = this.lhs.nullAnnotatedVariableBinding(compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8);
if (var != null) {
- nullStatus = checkAssignmentAgainstNullAnnotation(currentScope, flowContext, var, nullStatus, this.expression, this.expression.resolvedType);
+ nullStatus = NullAnnotationMatching.checkAssignment(currentScope, flowContext, var, nullStatus, this.expression, this.expression.resolvedType);
if (nullStatus == FlowInfo.NON_NULL
&& var instanceof FieldBinding
&& this.lhs instanceof Reference
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
index 0cf248e..8765ce2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java
@@ -21,6 +21,9 @@
* bug 383368 - [compiler][null] syntactic null analysis for field references
* bug 401017 - [compiler][null] casted reference to @Nullable field lacks a warning
* bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 415541 - [1.8][compiler] Type annotations in the body of static initializer get dropped
*******************************************************************************/
@@ -166,7 +169,8 @@
* Complain if assigned expression is cast, but not actually used as such, e.g. Object o = (List) object;
*/
public static void checkNeedForAssignedCast(BlockScope scope, TypeBinding expectedType, CastExpression rhs) {
- if (scope.compilerOptions().getSeverity(CompilerOptions.UnnecessaryTypeCheck) == ProblemSeverities.Ignore) return;
+ CompilerOptions compilerOptions = scope.compilerOptions();
+ if (compilerOptions.getSeverity(CompilerOptions.UnnecessaryTypeCheck) == ProblemSeverities.Ignore) return;
TypeBinding castedExpressionType = rhs.expression.resolvedType;
// int i = (byte) n; // cast still had side effect
@@ -174,6 +178,11 @@
if (castedExpressionType == null || rhs.resolvedType.isBaseType()) return;
//if (castedExpressionType.id == T_null) return; // tolerate null expression cast
if (castedExpressionType.isCompatibleWith(expectedType, scope)) {
+ if (compilerOptions.isAnnotationBasedNullAnalysisEnabled && compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8) {
+ // are null annotations compatible, too?
+ if (NullAnnotationMatching.analyse(expectedType, castedExpressionType, -1).isAnyMismatch())
+ return; // already reported unchecked cast (nullness), say no more.
+ }
scope.problemReporter().unnecessaryCast(rhs);
}
}
@@ -680,19 +689,31 @@
// SH}
if (castType != null) {
if (expressionType != null) {
- boolean isLegal = checkCastTypesCompatibility(scope, castType, expressionType, this.expression);
+
+ // internally for type checking use the unannotated types:
+ TypeBinding unannotatedCastType = castType.unannotated();
+ boolean nullAnnotationMismatch = NullAnnotationMatching.analyse(castType, expressionType, -1).isAnyMismatch();
+ if (nullAnnotationMismatch)
+ castType = unannotatedCastType; // problem exists, so use the unannotated type also externally
+ expressionType = expressionType.unannotated();
+
+ boolean isLegal = checkCastTypesCompatibility(scope, unannotatedCastType, expressionType, this.expression);
if (isLegal) {
- this.expression.computeConversion(scope, castType, expressionType);
+ this.expression.computeConversion(scope, unannotatedCastType, expressionType);
if ((this.bits & ASTNode.UnsafeCast) != 0) { // unsafe cast
//{ObjectTeams: getAllRoles requires an unchecked cast (T[]), don't report:
if (!scope.isGeneratedScope())
// SH}
- if (scope.compilerOptions().reportUnavoidableGenericTypeProblems || !this.expression.forcedToBeRaw(scope.referenceContext())) {
+ if (scope.compilerOptions().reportUnavoidableGenericTypeProblems
+ || !(expressionType.isRawType() && this.expression.forcedToBeRaw(scope.referenceContext()))) {
scope.problemReporter().unsafeCast(this, scope);
}
+ } else if (nullAnnotationMismatch) {
+ // report null annotation issue at medium priority
+ scope.problemReporter().unsafeNullnessCast(this, scope);
} else {
- if (castType.isRawType() && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){
- scope.problemReporter().rawTypeReference(this.type, castType);
+ if (unannotatedCastType.isRawType() && scope.compilerOptions().getSeverity(CompilerOptions.RawTypeReference) != ProblemSeverities.Ignore){
+ scope.problemReporter().rawTypeReference(this.type, unannotatedCastType);
}
if ((this.bits & (ASTNode.UnnecessaryCast|ASTNode.DisableUnnecessaryCastCheck)) == ASTNode.UnnecessaryCast) { // unnecessary cast
if (!isIndirectlyUsed()) // used for generic type inference or boxing ?
@@ -700,8 +721,8 @@
}
}
} else { // illegal cast
- if ((castType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error
- scope.problemReporter().typeCastError(this, castType, expressionType);
+ if ((unannotatedCastType.tagBits & TagBits.HasMissingType) == 0) { // no complaint if secondary error
+ scope.problemReporter().typeCastError(this, unannotatedCastType, expressionType);
}
this.bits |= ASTNode.DisableUnnecessaryCastCheck; // disable further secondary diagnosis
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
index 6be59ff..9a40876 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java
@@ -19,7 +19,8 @@
* bug 331649 - [compiler][null] consider null annotations for fields
* bug 383368 - [compiler][null] syntactic null analysis for field references
* bug 400421 - [compiler] Null analysis for fields does not take @com.google.inject.Inject into account
- * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 415399 - [1.8][compiler] Type annotations on constructor results dropped by the code generator
*******************************************************************************/
@@ -830,11 +831,7 @@
if (this.isCopied)
return;
// SH}
- if (this.typeParameters != null) {
- for (int i = 0, length = this.typeParameters.length; i < length; i++) {
- this.typeParameters[i].resolve(this.scope);
- }
- }
+ // typeParameters are already resolved from Scope#connectTypeVariables()
if (this.binding != null && !this.binding.isPrivate()) {
sourceType.tagBits |= TagBits.HasNonPrivateConstructor;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
index 8186ac7..8eb1e71 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java
@@ -17,6 +17,8 @@
* bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
* bug 331649 - [compiler][null] consider null annotations for fields
* bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
+ * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -265,6 +267,17 @@
initializationScope.lastVisibleFieldID = this.binding.id;
resolveAnnotations(initializationScope, this.annotations, this.binding);
+ // Check if this declaration should now have the type annotations bit set
+ if (this.annotations != null) {
+ for (int i = 0, max = this.annotations.length; i < max; i++) {
+ TypeBinding resolvedAnnotationType = this.annotations[i].resolvedType;
+ if (resolvedAnnotationType != null && (resolvedAnnotationType.getAnnotationTagBits() & TagBits.AnnotationForTypeUse) != 0) {
+ this.bits |= ASTNode.HasTypeAnnotations;
+ break;
+ }
+ }
+ }
+
// check @Deprecated annotation presence
if ((this.binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) == 0
&& (this.binding.modifiers & ClassFileConstants.AccDeprecated) != 0
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
index acfc3c5..11def6b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * 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
@@ -14,6 +18,8 @@
* bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations
* bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
* bug 393719 - [compiler] inconsistent warnings on iteration variables
+ * Bug 411964 - [1.8][null] leverage null type annotation in foreach statement
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Jesper S Moller - Contribution for
* bug 401853 - Eclipse Java compiler creates invalid bytecode (java.lang.VerifyError)
*******************************************************************************/
@@ -121,11 +127,9 @@
condInfo.nullInfoLessUnconditionalCopy();
actionInfo.markAsDefinitelyUnknown(elementVarBinding);
if (currentScope.compilerOptions().isAnnotationBasedNullAnalysisEnabled) {
- // this currently produces an unavoidable warning against all @NonNull element vars:
- int nullStatus = this.elementVariable.checkAssignmentAgainstNullAnnotation(currentScope, flowContext,
- elementVarBinding, FlowInfo.UNKNOWN, this.collection, this.collectionElementType);
- // TODO (stephan): once we have JSR 308 fetch nullStatus from the collection element type
- // and feed the result into the above check (instead of FlowInfo.UNKNOWN)
+ int elementNullStatus = FlowInfo.tagBitsToNullStatus(this.collectionElementType.tagBits);
+ int nullStatus = NullAnnotationMatching.checkAssignment(currentScope, flowContext, elementVarBinding, elementNullStatus,
+ this.collection, this.collectionElementType);
if ((elementVarBinding.type.tagBits & TagBits.IsBaseType) == 0) {
actionInfo.markNullStatus(elementVarBinding, nullStatus);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
index 358971c..55c205c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java
@@ -15,6 +15,9 @@
* Technical University Berlin - extended API and implementation
* Stephan Herrmann - Contribution for
* bug 383368 - [compiler][null] syntactic null analysis for field references
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Andy Clement - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
*******************************************************************************/
@@ -151,6 +154,10 @@
this.constant = Constant.NotAConstant;
TypeBinding expressionType = this.expression.resolveType(scope);
TypeBinding checkedType = this.type.resolveType(scope, true /* check bounds*/);
+ if (expressionType != null && checkedType != null && NullAnnotationMatching.analyse(checkedType, expressionType, -1).isAnyMismatch()) {
+ scope.problemReporter().nullAnnotationUnsupportedLocation(this.type);
+ checkedType = checkedType.unannotated();
+ }
if (expressionType == null || checkedType == null)
return null;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
index f17ed02..37a49d1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java
@@ -14,9 +14,11 @@
* Jesper S Moller - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
* Stephan Herrmann - Contribution for
* bug 401030 - [1.8][null] Null analysis support for lambda methods.
- * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -115,7 +117,7 @@
signature.append(')');
signature.append(this.expectedType.signature());
int invokeDynamicNumber = codeStream.classFile.recordBootstrapMethod(this);
- codeStream.invokeDynamic(invokeDynamicNumber, (this.shouldCaptureInstance ? 1 : 0) + this.outerLocalVariablesSlotSize, 1, TypeConstants.ANONYMOUS_METHOD, signature.toString().toCharArray());
+ codeStream.invokeDynamic(invokeDynamicNumber, (this.shouldCaptureInstance ? 1 : 0) + this.outerLocalVariablesSlotSize, 1, this.descriptor.selector, signature.toString().toCharArray());
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
@@ -349,8 +351,8 @@
if (this.binding != null) {
int length = this.binding.parameters.length;
for (int i=0; i<length; i++) {
- long nullAnnotationTagBit = this.binding.returnType.tagBits & TagBits.AnnotationNullMASK;
- this.scope.validateNullAnnotation(nullAnnotationTagBit, this.arguments[i].type, this.arguments[i].annotations);
+ if (!this.scope.validateNullAnnotation(this.binding.returnType.tagBits, this.arguments[i].type, this.arguments[i].annotations))
+ this.binding.returnType = this.binding.returnType.unannotated();
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
index 81dd316..d09b7a4 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java
@@ -27,8 +27,12 @@
* bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
* bug 383368 - [compiler][null] syntactic null analysis for field references
* bug 400761 - [compiler][null] null may be return as boolean without a diagnostic
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Jesper S Moller - Contributions for
* Bug 378674 - "The method can be declared as static" is wrong
+ * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -139,7 +143,7 @@
this.bits &= ~FirstAssignmentToLocal; // int i = (i = 0);
}
flowInfo.markAsDefinitelyAssigned(this.binding);
- nullStatus = checkAssignmentAgainstNullAnnotation(currentScope, flowContext, this.binding, nullStatus, this.initialization, this.initialization.resolvedType);
+ nullStatus = NullAnnotationMatching.checkAssignment(currentScope, flowContext, this.binding, nullStatus, this.initialization, this.initialization.resolvedType);
if ((this.binding.type.tagBits & TagBits.IsBaseType) == 0) {
flowInfo.markNullStatus(this.binding, nullStatus);
// no need to inform enclosing try block since its locals won't get
@@ -366,7 +370,18 @@
}
// only resolve annotation at the end, for constant to be positioned before (96991)
resolveAnnotations(scope, this.annotations, this.binding);
- scope.validateNullAnnotation(this.binding.tagBits, this.type, this.annotations);
+ // Check if this declaration should now have the type annotations bit set
+ if (this.annotations != null) {
+ for (int i = 0, max = this.annotations.length; i < max; i++) {
+ TypeBinding resolvedAnnotationType = this.annotations[i].resolvedType;
+ if (resolvedAnnotationType != null && (resolvedAnnotationType.getAnnotationTagBits() & TagBits.AnnotationForTypeUse) != 0) {
+ this.bits |= ASTNode.HasTypeAnnotations;
+ break;
+ }
+ }
+ }
+ if (!scope.validateNullAnnotation(this.binding.tagBits, this.type, this.annotations))
+ this.binding.tagBits &= ~TagBits.AnnotationNullMASK;
}
public void traverse(ASTVisitor visitor, BlockScope scope) {
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 b4a1aa3..f8af089 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
@@ -37,6 +37,8 @@
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 405569 - Resource leak check false positive when using DbUtils.closeQuietly
+ * Bug 411964 - [1.8][null] leverage null type annotation in foreach statement
* Jesper S Moller - Contributions for
* Bug 378674 - "The method can be declared as static" is wrong
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
@@ -185,7 +187,8 @@
flowInfo = this.receiver.analyseCode(currentScope, flowContext, flowInfo, nonStatic).unconditionalInits();
// recording the closing of AutoCloseable resources:
- boolean analyseResources = currentScope.compilerOptions().analyseResourceLeaks;
+ CompilerOptions compilerOptions = currentScope.compilerOptions();
+ boolean analyseResources = compilerOptions.analyseResourceLeaks;
if (analyseResources) {
Expression closeTarget = null;
if (nonStatic) {
@@ -249,10 +252,12 @@
}
analyseArguments(currentScope, flowContext, flowInfo, this.binding, this.arguments);
}
- if (this.binding instanceof ParameterizedGenericMethodBinding && this.typeArguments != null) {
- ParameterizedGenericMethodBinding parameterizedBinding = (ParameterizedGenericMethodBinding) this.binding;
- for (int i = 0; i < this.typeArguments.length; i++)
- parameterizedBinding.checkNullConstraints(currentScope, this.typeArguments[i], i);
+ if (compilerOptions.isAnnotationBasedNullAnalysisEnabled && compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8) {
+ if (this.binding instanceof ParameterizedGenericMethodBinding && this.typeArguments != null) {
+ TypeVariableBinding[] typeVariables = this.binding.original().typeVariables();
+ for (int i = 0; i < this.typeArguments.length; i++)
+ this.typeArguments[i].checkNullConstraints(currentScope, typeVariables, i);
+ }
}
ReferenceBinding[] thrownExceptions;
if ((thrownExceptions = this.binding.thrownExceptions) != Binding.NO_EXCEPTIONS) {
@@ -697,13 +702,10 @@
public int nullStatus(FlowInfo flowInfo, FlowContext flowContext) {
if (this.binding.isValidBinding()) {
// try to retrieve null status of this message send from an annotation of the called method:
- long tagBits = this.binding.tagBits & TagBits.AnnotationNullMASK;
- if (tagBits == 0L) // alternatively look for type annotation (will only be present in 1.8+):
- tagBits = this.binding.returnType.tagBits & TagBits.AnnotationNullMASK;
- if ((tagBits & TagBits.AnnotationNonNull) != 0)
- return FlowInfo.NON_NULL;
- if ((tagBits & TagBits.AnnotationNullable) != 0)
- return FlowInfo.POTENTIALLY_NULL | FlowInfo.POTENTIALLY_NON_NULL;
+ long tagBits = this.binding.tagBits;
+ if ((tagBits & TagBits.AnnotationNullMASK) == 0L) // alternatively look for type annotation (will only be present in 1.8+):
+ tagBits = this.binding.returnType.tagBits;
+ return FlowInfo.tagBitsToNullStatus(tagBits);
}
return FlowInfo.UNKNOWN;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
index ee760a7..73077e7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java
@@ -20,7 +20,9 @@
* bug 368546 - [compiler][resource] Avoid remaining false positives found when compiling the Eclipse SDK
* bug 382353 - [1.8][compiler] Implementation property modifiers should be accepted on default methods.
* bug 383368 - [compiler][null] syntactic null analysis for field references
- * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
* Jesper S Moller <jesper@selskabet.org> - Contributions for
* bug 378674 - "The method can be declared as static" is wrong
*******************************************************************************/
@@ -285,7 +287,7 @@
for (int i = 0, length = this.typeParameters.length; i < length; i++) {
TypeParameter typeParameter = this.typeParameters[i];
this.bits |= (typeParameter.bits & ASTNode.HasTypeAnnotations);
- typeParameter.resolve(this.scope);
+ // typeParameter is already resolved from Scope#connectTypeVariables()
if (returnsUndeclTypeVar && this.typeParameters[i].binding == this.returnType.resolvedType) {
returnsUndeclTypeVar = false;
}
@@ -456,13 +458,4 @@
public TypeParameter[] typeParameters() {
return this.typeParameters;
}
-
- void validateNullAnnotations(long sourceLevel) {
- super.validateNullAnnotations(sourceLevel);
- // null-annotations on the return type?
- if (this.binding != null && this.binding.returnType != null) {
- long tagBits = (sourceLevel < ClassFileConstants.JDK1_8) ? this.binding.tagBits : this.binding.returnType.tagBits;
- this.scope.validateNullAnnotation(tagBits, this.returnType, this.annotations);
- }
- }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java
new file mode 100644
index 0000000..53e8455
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java
@@ -0,0 +1,176 @@
+/*******************************************************************************
+ * Copyright (c) 2013 GK Software AG 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
+ *
+ * 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
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.ast;
+
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.flow.FlowContext;
+import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
+import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TagBits;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
+import org.eclipse.jdt.internal.compiler.lookup.VariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
+
+/**
+ * Performs matching of null type annotations.
+ * Instances are used to encode result from this analysis.
+ * @since 3.9 BETA_JAVA8
+ */
+public class NullAnnotationMatching {
+
+ public static final NullAnnotationMatching NULL_ANNOTATIONS_OK = new NullAnnotationMatching(0, null);
+ public static final NullAnnotationMatching NULL_ANNOTATIONS_UNCHECKED = new NullAnnotationMatching(1, null);
+ public static final NullAnnotationMatching NULL_ANNOTATIONS_MISMATCH = new NullAnnotationMatching(2, null);
+
+ /** 0 = OK, 1 = unchecked, 2 = definite mismatch */
+ public final int severity;
+
+ /** If non-null this field holds the supertype of the provided type which was used for direct matching. */
+ public final TypeBinding superTypeHint;
+
+ public NullAnnotationMatching(int severity, TypeBinding superTypeHint) {
+ this.severity = severity;
+ this.superTypeHint = superTypeHint;
+ }
+
+ public boolean isAnyMismatch() { return this.severity != 0; }
+ public boolean isUnchecked() { return this.severity == 1; }
+ public boolean isDefiniteMismatch() { return this.severity == 2; }
+
+ public String superTypeHintName(CompilerOptions options, boolean shortNames) {
+ return String.valueOf(this.superTypeHint.nullAnnotatedReadableName(options, shortNames));
+ }
+
+ /** Check null-ness of 'var' against a possible null annotation */
+ public static int checkAssignment(BlockScope currentScope, FlowContext flowContext,
+ VariableBinding var, int nullStatus, Expression expression, TypeBinding providedType)
+ {
+ long lhsTagBits = 0L;
+ boolean hasReported = false;
+ if (currentScope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8) {
+ lhsTagBits = var.tagBits & TagBits.AnnotationNullMASK;
+ } else {
+ lhsTagBits = var.type.tagBits & TagBits.AnnotationNullMASK;
+ NullAnnotationMatching annotationStatus = analyse(var.type, providedType, nullStatus);
+ if (annotationStatus.isDefiniteMismatch()) {
+ currentScope.problemReporter().nullityMismatchingTypeAnnotation(expression, providedType, var.type, annotationStatus);
+ hasReported = true;
+ } else if (annotationStatus.isUnchecked()) {
+ flowContext.recordNullityMismatch(currentScope, expression, providedType, var.type, nullStatus);
+ hasReported = true;
+ }
+ }
+ if (lhsTagBits == TagBits.AnnotationNonNull && nullStatus != FlowInfo.NON_NULL) {
+ if (!hasReported)
+ flowContext.recordNullityMismatch(currentScope, expression, providedType, var.type, nullStatus);
+ return FlowInfo.NON_NULL;
+ } else if (lhsTagBits == TagBits.AnnotationNullable && nullStatus == FlowInfo.UNKNOWN) { // provided a legacy type?
+ return FlowInfo.POTENTIALLY_NULL; // -> use more specific info from the annotation
+ }
+ return nullStatus;
+ }
+
+ /**
+ * Find any mismatches between the two given types, which are caused by null type annotations.
+ * @param requiredType
+ * @param providedType
+ * @param nullStatus we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignored
+ * @return a status object representing the severity of mismatching plus optionally a supertype hint
+ */
+ public static NullAnnotationMatching analyse(TypeBinding requiredType, TypeBinding providedType, int nullStatus) {
+ int severity = 0;
+ TypeBinding superTypeHint = null;
+ if (requiredType instanceof ArrayBinding) {
+ long[] requiredDimsTagBits = ((ArrayBinding)requiredType).nullTagBitsPerDimension;
+ if (requiredDimsTagBits != null) {
+ int dims = requiredType.dimensions();
+ if (requiredType.dimensions() == providedType.dimensions()) {
+ long[] providedDimsTagBits = ((ArrayBinding)providedType).nullTagBitsPerDimension;
+ if (providedDimsTagBits == null) {
+ severity = 1; // required is annotated, provided not, need unchecked conversion
+ } else {
+ for (int i=0; i<dims; i++) {
+ long requiredBits = requiredDimsTagBits[i] & TagBits.AnnotationNullMASK;
+ long providedBits = providedDimsTagBits[i] & TagBits.AnnotationNullMASK;
+ if (i > 0)
+ nullStatus = -1; // don't use beyond the outermost dimension
+ severity = Math.max(severity, computeNullProblemSeverity(requiredBits, providedBits, nullStatus));
+ if (severity == 2)
+ return NullAnnotationMatching.NULL_ANNOTATIONS_MISMATCH;
+ }
+ }
+ } else if (providedType.id == TypeIds.T_null) {
+ if (dims > 0 && requiredDimsTagBits[0] == TagBits.AnnotationNonNull)
+ return NullAnnotationMatching.NULL_ANNOTATIONS_MISMATCH;
+ }
+ }
+ } else if (requiredType.hasNullTypeAnnotations() || providedType.hasNullTypeAnnotations()) {
+ long requiredBits = requiredType.tagBits & TagBits.AnnotationNullMASK;
+ if (requiredBits != TagBits.AnnotationNullable // nullable lhs accepts everything, ...
+ || nullStatus == -1) // only at detail/recursion even nullable must be matched exactly
+ {
+ long providedBits = providedType.tagBits & TagBits.AnnotationNullMASK;
+ severity = computeNullProblemSeverity(requiredBits, providedBits, nullStatus);
+ }
+ if (severity < 2) {
+ TypeBinding providedSuper = providedType.findSuperTypeOriginatingFrom(requiredType);
+ if (providedSuper != providedType)
+ superTypeHint = providedSuper;
+ if (requiredType.isParameterizedType() && providedSuper instanceof ParameterizedTypeBinding) { // TODO(stephan): handle providedType.isRaw()
+ TypeBinding[] requiredArguments = ((ParameterizedTypeBinding) requiredType).arguments;
+ TypeBinding[] providedArguments = ((ParameterizedTypeBinding) providedSuper).arguments;
+ if (requiredArguments != null && providedArguments != null && requiredArguments.length == providedArguments.length) {
+ for (int i = 0; i < requiredArguments.length; i++) {
+ NullAnnotationMatching status = analyse(requiredArguments[i], providedArguments[i], -1);
+ severity = Math.max(severity, status.severity);
+ if (severity == 2)
+ return new NullAnnotationMatching(severity, superTypeHint);
+ }
+ }
+ } else if (requiredType instanceof WildcardBinding) {
+ NullAnnotationMatching status = analyse(((WildcardBinding) requiredType).bound, providedType, nullStatus);
+ severity = Math.max(severity, status.severity);
+ }
+ TypeBinding requiredEnclosing = requiredType.enclosingType();
+ TypeBinding providedEnclosing = providedType.enclosingType();
+ if (requiredEnclosing != null && providedEnclosing != null) {
+ NullAnnotationMatching status = analyse(requiredEnclosing, providedEnclosing, -1);
+ severity = Math.max(severity, status.severity);
+ }
+ }
+ }
+ if (severity == 0)
+ return NullAnnotationMatching.NULL_ANNOTATIONS_OK;
+ return new NullAnnotationMatching(severity, superTypeHint);
+ }
+
+ private static int computeNullProblemSeverity(long requiredBits, long providedBits, int nullStatus) {
+ if (requiredBits != 0 && requiredBits != providedBits) {
+ if (providedBits != 0) {
+ return 2; // mismatching annotations
+ } else {
+ if (requiredBits == TagBits.AnnotationNonNull && nullStatus == FlowInfo.NON_NULL) {
+ return 0; // OK by flow analysis
+ }
+ return 1; // need unchecked conversion regarding type detail
+ }
+ }
+ return 0; // OK by tagBits
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
index ff7bfb5..e1decab 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java
@@ -17,6 +17,7 @@
* bug 342671 - ClassCastException: org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.ArrayBinding
* bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 416181 – [1.8][compiler][null] Invalid assignment is not rejected by the compiler
* Andy Clement - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
*******************************************************************************/
@@ -185,9 +186,12 @@
}
}
this.bits |= ASTNode.DidResolve;
- resolveAnnotations(scope);
TypeBinding type = internalResolveLeafType(scope, checkBounds);
createArrayType(scope);
+ resolveAnnotations(scope);
+ if (this.typeArguments != null)
+ // relevant null annotations are on the inner most type:
+ checkNullConstraints(scope, this.typeArguments[this.typeArguments.length-1]);
return type == null ? type : this.resolvedType;
}
private TypeBinding internalResolveLeafType(Scope scope, boolean checkBounds) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java
index b29dbb8..7386a04 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java
@@ -268,6 +268,8 @@
:giro */
// SH}
resolveAnnotations(scope);
+ checkNullConstraints(scope, this.typeArguments);
+
// handle three different outcomes:
if (type == null) {
this.resolvedType = createArrayType(scope, this.resolvedType);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
index 6d73f6c..048aaee 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java
@@ -25,11 +25,15 @@
* Andy Clement - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
* Jesper S Moller <jesper@selskabet.org> - Contributions for
* bug 378674 - "The method can be declared as static" is wrong
- * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
+ * Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409245 - [1.8][compiler] Type annotations dropped when call is routed through a synthetic bridge method
+ * Till Brychcy - Contributions for
+ * bug 413460 - NonNullByDefault is not inherited to Constructors when accessed via Class File
******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -39,10 +43,12 @@
import org.eclipse.jdt.internal.compiler.codegen.Opcodes;
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
+import org.eclipse.jdt.internal.compiler.lookup.ImplicitNullAnnotationVerifier;
import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
@@ -158,6 +164,7 @@
// The corresponding problem (when called from static) is not produced until during code generation
}
}
+
}
// check captured variables are initialized in current context (26134)
@@ -345,7 +352,20 @@
if (this.anonymousType == null && this.enclosingInstance == null) {
return super.resolveType(scope);
}
-
+ TypeBinding result=resolveTypeForQualifiedAllocationExpression(scope);
+ if(result != null && this.binding != null) {
+ final CompilerOptions compilerOptions = scope.compilerOptions();
+ if (compilerOptions.isAnnotationBasedNullAnalysisEnabled && (this.binding.tagBits & TagBits.IsNullnessKnown) == 0) {
+//{ObjectTeams: added 2nd arg:
+ new ImplicitNullAnnotationVerifier(compilerOptions.inheritNullAnnotations, scope.environment())
+// SH}
+ .checkImplicitNullAnnotations(this.binding, null/*srcMethod*/, false, scope);
+ }
+ }
+ return result;
+ }
+
+ private TypeBinding resolveTypeForQualifiedAllocationExpression(BlockScope scope) {
// Propagate the type checking to the arguments, and checks if the constructor is defined.
// ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
// ClassInstanceCreationExpression ::= Name '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt
@@ -391,6 +411,7 @@
hasError = true;
} else {
receiverType = ((SingleTypeReference) this.type).resolveTypeEnclosing(scope, (ReferenceBinding) enclosingInstanceType);
+ receiverType = checkIllegalNullAnnotation(scope, receiverType);
if (receiverType != null && enclosingInstanceContainsCast) {
CastExpression.checkNeedForEnclosingInstanceCast(scope, this.enclosingInstance, enclosingInstanceType, receiverType);
}
@@ -401,6 +422,7 @@
receiverType = scope.enclosingSourceType();
} else {
receiverType = this.type.resolveType(scope, true /* check bounds*/);
+ receiverType = checkIllegalNullAnnotation(scope, receiverType);
checkParameterizedAllocation: {
if (receiverType == null || !receiverType.isValidBinding()) break checkParameterizedAllocation;
if (this.type instanceof ParameterizedQualifiedTypeReference) { // disallow new X<String>.Y<Integer>()
@@ -549,7 +571,7 @@
null, this.arguments, scope);
try {
// orig:
- this.binding = scope.getConstructor(allocationType, argumentTypes, this);
+ this.binding = scope.getConstructor(allocationType, argumentTypes, this);
// :giro
} finally {
AnchorMapping.removeCurrentMapping(anchorMapping);
@@ -557,7 +579,7 @@
// SH}
if (polyExpressionSeen && polyExpressionsHaveErrors(scope, this.binding, this.arguments, argumentTypes))
return null;
- if (this.binding.isValidBinding()) {
+ if (this.binding.isValidBinding()) {
if (isMethodUseDeprecated(this.binding, scope, true)) {
scope.problemReporter().deprecatedMethod(this.binding, this);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
index 49980af..eebe55f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java
@@ -19,6 +19,7 @@
* bug 365519 - editorial cleanup after bug 186342 and bug 365387
* bug 368546 - [compiler][resource] Avoid remaining false positives found when compiling the Eclipse SDK
* bug 345305 - [compiler][null] Compiler misidentifies a case of "variable can only be null"
+ * Bug 414380 - [compiler][internal] QualifiedNameReference#indexOfFirstFieldBinding does not point to the first field
* Jesper S Moller - Contributions for
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
* bug 331649 - [compiler][null] consider null annotations for fields
@@ -99,7 +100,9 @@
public long[] sourcePositions;
public FieldBinding[] otherBindings;
int[] otherDepths;
- public int indexOfFirstFieldBinding;//points (into tokens) for the first token that corresponds to first FieldBinding
+ public int indexOfFirstFieldBinding; // points into tokens & sourcePositions for the first token that corresponds to first FieldBinding
+ // *** the index is 1-based ***
+ // during BlockScope#getBinding(..) it will walk through positions until it finds the first field
public SyntheticMethodBinding syntheticWriteAccessor;
public SyntheticMethodBinding[] syntheticReadAccessors;
public TypeBinding genericCast;
@@ -289,12 +292,12 @@
if (this.otherBindings != null) {
if ((this.bits & ASTNode.RestrictiveFlagMASK) == Binding.FIELD) {
// is the first field dereferenced annotated Nullable? If so, report immediately
- checkNullableFieldDereference(scope, (FieldBinding) this.binding, this.sourcePositions[0]);
+ checkNullableFieldDereference(scope, (FieldBinding) this.binding, this.sourcePositions[this.indexOfFirstFieldBinding-1]);
}
// look for annotated fields, they do not depend on flow context -> check immediately:
int length = this.otherBindings.length - 1; // don't check the last binding
for (int i = 0; i < length; i++) {
- checkNullableFieldDereference(scope, this.otherBindings[i], this.sourcePositions[i+1]);
+ checkNullableFieldDereference(scope, this.otherBindings[i], this.sourcePositions[this.indexOfFirstFieldBinding+i]);
}
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
index f3f6680..95c56db 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java
@@ -108,7 +108,6 @@
LookupEnvironment env = scope.environment();
try {
env.missingClassFileLocation = this;
- ReferenceBinding previousType = null;
if (this.resolvedType == null) {
this.resolvedType = scope.getType(this.tokens[tokenIndex], packageBinding);
} else {
@@ -116,8 +115,6 @@
if (this.resolvedType.isRole())
this.resolvedType = ((ReferenceBinding)this.resolvedType).roleModel.getClassPartBinding();
// SH}
- if (this.resolvedType instanceof ReferenceBinding)
- previousType = (ReferenceBinding) this.resolvedType;
this.resolvedType = scope.getMemberType(this.tokens[tokenIndex], (ReferenceBinding) this.resolvedType);
if (!this.resolvedType.isValidBinding()) {
this.resolvedType = new ProblemReferenceBinding(
@@ -126,9 +123,6 @@
this.resolvedType.problemId());
}
}
- if (this.annotations != null && this.annotations[tokenIndex] != null) {
- this.resolvedType = captureTypeAnnotations(scope, previousType, this.resolvedType, this.annotations[tokenIndex]);
- }
//{ObjectTeams: baseclass decapsulation?
checkBaseclassDecapsulation(scope);
// SH}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
index 43b1864..6dae5dc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java
@@ -20,6 +20,7 @@
* bug 383368 - [compiler][null] syntactic null analysis for field references
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 411964 - [1.8][null] leverage null type annotation in foreach statement
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -169,10 +170,7 @@
}
}
if (this.resolvedType != null) {
- if ((this.resolvedType.tagBits & TagBits.AnnotationNonNull) != 0)
- return FlowInfo.NON_NULL;
- else if ((this.resolvedType.tagBits & TagBits.AnnotationNullable) != 0)
- return FlowInfo.POTENTIALLY_NULL;
+ return FlowInfo.tagBitsToNullStatus(this.resolvedType.tagBits);
}
return FlowInfo.UNKNOWN;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
index 4268c66..6dc9e6b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java
@@ -14,10 +14,12 @@
* Jesper S Moller - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
* Bug 384687 - [1.8] Wildcard type arguments should be rejected for lambda and reference expressions
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
* Stephan Herrmann - Contribution for
* bug 402028 - [1.8][compiler] null analysis for reference expressions
* bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super via I.super.m() syntax
- * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contribution for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
*******************************************************************************/
@@ -57,7 +59,6 @@
public class ReferenceExpression extends FunctionalExpression implements InvocationSite {
- private static char [] LAMBDA = { 'l', 'a', 'm', 'b', 'd', 'a' };
public Expression lhs;
public TypeReference [] typeArguments;
public char [] selector;
@@ -153,7 +154,7 @@
buffer.append(this.resolvedType.constantPoolName());
buffer.append(';');
int invokeDynamicNumber = codeStream.classFile.recordBootstrapMethod(this);
- codeStream.invokeDynamic(invokeDynamicNumber, argumentsSize, 1, LAMBDA, buffer.toString().toCharArray(),
+ codeStream.invokeDynamic(invokeDynamicNumber, argumentsSize, 1, this.descriptor.selector, buffer.toString().toCharArray(),
this.isConstructorReference(), (this.lhs instanceof TypeReference? (TypeReference) this.lhs : null), this.typeArguments);
codeStream.recordPositionsFrom(pc, this.sourceStart);
}
@@ -351,6 +352,7 @@
}
MethodBinding anotherMethod = null;
+ int paramOffset = 0;
if (!this.haveReceiver && isMethodReference && parametersLength > 0) {
final TypeBinding potentialReceiver = descriptorParameters[0];
if (potentialReceiver.isCompatibleWith(this.receiverType, scope)) {
@@ -369,6 +371,7 @@
anotherMethod = scope.getMethod(typeToSearch, this.selector, parameters, this);
anotherMethodDepth = this.depth;
this.depth = 0;
+ paramOffset = 1; // 0 is receiver, real parameters start at 1
}
if (anotherMethod != null && anotherMethod.isValidBinding() && anotherMethod.isStatic()) {
scope.problemReporter().methodMustBeAccessedStatically(this, anotherMethod);
@@ -442,20 +445,20 @@
scope.problemReporter().unhandledException(methodExceptions[i], this);
}
if (scope.compilerOptions().isAnnotationBasedNullAnalysisEnabled) {
- int len = this.descriptor.parameters.length;
+ int len = this.binding.parameters.length;
for (int i = 0; i < len; i++) {
- long declared = this.descriptor.parameters[i].tagBits & TagBits.AnnotationNullMASK;
+ long declared = this.descriptor.parameters[i+paramOffset].tagBits & TagBits.AnnotationNullMASK;
long implemented = this.binding.parameters[i].tagBits & TagBits.AnnotationNullMASK;
if (declared == TagBits.AnnotationNullable) { // promise to accept null
if (implemented != TagBits.AnnotationNullable) {
char[][] requiredAnnot = implemented == 0L ? null : scope.environment().getNonNullAnnotationName();
- scope.problemReporter().parameterLackingNullableAnnotation(this, this.descriptor, i,
+ scope.problemReporter().parameterLackingNullableAnnotation(this, this.descriptor, i, paramOffset,
scope.environment().getNullableAnnotationName(),
requiredAnnot, this.binding.parameters[i]);
}
} else if (declared == 0L) {
if (implemented == TagBits.AnnotationNonNull) {
- scope.problemReporter().parameterRequiresNonnull(this, this.descriptor, i,
+ scope.problemReporter().parameterRequiresNonnull(this, this.descriptor, i+paramOffset,
scope.environment().getNonNullAnnotationName(), this.binding.parameters[i]);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
index c24beea..c2ab7bf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java
@@ -31,6 +31,7 @@
* bug 401030 - [1.8][null] Null analysis support for lambda methods.
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
* Jesper S Moller - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
*******************************************************************************/
@@ -177,16 +178,13 @@
return;
}
if (useTypeAnnotations) {
- int severity = findNullTypeAnnotationMismatch(methodBinding.returnType, this.expression.resolvedType, nullStatus);
- if (severity == 2) {
- scope.problemReporter().nullityMismatchingTypeAnnotation(this.expression, this.expression.resolvedType, methodBinding.returnType, severity);
- return;
- } else if (severity == 1) {
+ NullAnnotationMatching annotationStatus = NullAnnotationMatching.analyse(methodBinding.returnType, this.expression.resolvedType, nullStatus);
+ if (annotationStatus.isDefiniteMismatch()) {
+ scope.problemReporter().nullityMismatchingTypeAnnotation(this.expression, this.expression.resolvedType, methodBinding.returnType, annotationStatus);
+ } else if (annotationStatus.isUnchecked()) {
flowContext.recordNullityMismatch(scope, this.expression, this.expression.resolvedType, methodBinding.returnType, nullStatus);
- return;
}
- }
- if (nullStatus != FlowInfo.NON_NULL) {
+ } else if (nullStatus != FlowInfo.NON_NULL) {
// if we can't prove non-null check against declared null-ness of the enclosing method:
if ((tagBits & TagBits.AnnotationNonNull) != 0) {
flowContext.recordNullityMismatch(scope, this.expression, this.expression.resolvedType, methodBinding.returnType, nullStatus);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
index a3d8b41..87d909d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java
@@ -22,6 +22,7 @@
* Jesper S Moller - <jesper@selskabet.org> - Contributions for
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
* bug 378674 - "The method can be declared as static" is wrong
+ * bug 404657 - [1.8][compiler] Analysis for effectively final variables fails to consider loops
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -158,19 +159,23 @@
} else {
this.bits &= ~ASTNode.FirstAssignmentToLocal;
}
- if (flowInfo.isPotentiallyAssigned(localBinding)) {
+ if (flowInfo.isPotentiallyAssigned(localBinding) || (this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
localBinding.tagBits &= ~TagBits.IsEffectivelyFinal;
if (!isFinal && (this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
currentScope.problemReporter().cannotReferToNonEffectivelyFinalOuterLocal(localBinding, this);
}
}
- if (isFinal) {
+ if (! isFinal && (localBinding.tagBits & TagBits.IsEffectivelyFinal) != 0 && (localBinding.tagBits & TagBits.IsArgument) == 0) {
+ flowContext.recordSettingFinal(localBinding, this, flowInfo);
+ } else if (isFinal) {
if ((this.bits & ASTNode.DepthMASK) == 0) {
// tolerate assignment to final local in unreachable code (45674)
if ((isReachable && isCompound) || !localBinding.isBlankFinal()){
currentScope.problemReporter().cannotAssignToFinalLocal(localBinding, this);
} else if (flowInfo.isPotentiallyAssigned(localBinding)) {
currentScope.problemReporter().duplicateInitializationOfFinalLocal(localBinding, this);
+ } else if ((this.bits & ASTNode.IsCapturedOuterLocal) != 0) {
+ currentScope.problemReporter().cannotAssignToFinalOuterLocal(localBinding, this);
} else {
flowContext.recordSettingFinal(localBinding, this, flowInfo);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
index e86f60a..acc2281 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java
@@ -13,6 +13,8 @@
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
* Technical University Berlin - extended API and implementation
+ * Stephan Herrmann - Contribution for
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -94,21 +96,22 @@
}
public TypeBinding resolveTypeEnclosing(BlockScope scope, ReferenceBinding enclosingType) {
- TypeBinding memberType = this.resolvedType = scope.getMemberType(this.token, enclosingType);
+ this.resolvedType = scope.getMemberType(this.token, enclosingType);
//{ObjectTeams: decapsulation:
- if (memberType.problemId() == ProblemReasons.NotVisible) {
+ if (this.resolvedType.problemId() == ProblemReasons.NotVisible) {
switch(this.getBaseclassDecapsulation()) {
case ALLOWED:
scope.problemReporter().decapsulation(this);
//$FALL-THROUGH$
case REPORTED:
- memberType= ((ProblemReferenceBinding)memberType).closestMatch();
+ this.resolvedType= ((ProblemReferenceBinding)this.resolvedType).closestMatch();
}
}
// SH}
boolean hasError = false;
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=391500
resolveAnnotations(scope);
+ TypeBinding memberType = this.resolvedType; // load after possible update in resolveAnnotations()
if (!memberType.isValidBinding()) {
hasError = true;
scope.problemReporter().invalidEnclosingType(this, memberType, enclosingType);
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 5c7e4d4..431d791 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
@@ -27,8 +27,11 @@
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
* Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
* Andy Clement - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -143,119 +146,16 @@
}
void analyseOneArgument18(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo,
TypeBinding expectedType, Expression argument) {
- int nullStatus = argument.nullStatus(flowInfo, flowContext); // slight loss of precision: should also use the null info from the receiver.
- int severity = findNullTypeAnnotationMismatch(expectedType, argument.resolvedType, nullStatus);
- switch (severity) {
- case 2:
- // immediate reporting:
- currentScope.problemReporter().nullityMismatchingTypeAnnotation(argument, argument.resolvedType, expectedType, severity);
- return;
- case 1:
- flowContext.recordNullityMismatch(currentScope, argument, argument.resolvedType, expectedType, nullStatus);
- return;
- }
- if ((expectedType.tagBits & TagBits.AnnotationNonNull) != 0 && nullStatus != FlowInfo.NON_NULL) {
+ int nullStatus = argument.nullStatus(flowInfo, flowContext);
+ NullAnnotationMatching annotationStatus = NullAnnotationMatching.analyse(expectedType, argument.resolvedType, nullStatus);
+ if (annotationStatus.isDefiniteMismatch()) {
+ // immediate reporting:
+ currentScope.problemReporter().nullityMismatchingTypeAnnotation(argument, argument.resolvedType, expectedType, annotationStatus);
+ } else if (annotationStatus.isUnchecked()) {
flowContext.recordNullityMismatch(currentScope, argument, argument.resolvedType, expectedType, nullStatus);
}
}
-/** Check null-ness of 'var' against a possible null annotation */
-protected int checkAssignmentAgainstNullAnnotation(BlockScope currentScope, FlowContext flowContext,
- VariableBinding var, int nullStatus, Expression expression, TypeBinding providedType)
-{
- long lhsTagBits = 0L;
- boolean hasReported = false;
- if (currentScope.compilerOptions().sourceLevel < ClassFileConstants.JDK1_8) {
- lhsTagBits = var.tagBits & TagBits.AnnotationNullMASK;
- } else {
- lhsTagBits = var.type.tagBits & TagBits.AnnotationNullMASK;
- int severity = findNullTypeAnnotationMismatch(var.type, providedType, nullStatus);
- if (severity == 2) {
- currentScope.problemReporter().nullityMismatchingTypeAnnotation(expression, providedType, var.type, severity);
- hasReported = true;
- } else if (severity == 1) {
- flowContext.recordNullityMismatch(currentScope, expression, providedType, var.type, nullStatus);
- hasReported = true;
- }
- }
- if (lhsTagBits == TagBits.AnnotationNonNull && nullStatus != FlowInfo.NON_NULL) {
- if (!hasReported)
- flowContext.recordNullityMismatch(currentScope, expression, providedType, var.type, nullStatus);
- return FlowInfo.NON_NULL;
- } else if (lhsTagBits == TagBits.AnnotationNullable && nullStatus == FlowInfo.UNKNOWN) { // provided a legacy type?
- return FlowInfo.POTENTIALLY_NULL; // -> use more specific info from the annotation
- }
- return nullStatus;
-}
-// return: severity: 0 = no problem; 1 = unchecked conversion wrt type detail; 2 = conflicting annotations
-// nullStatus: we are only interested in NULL or NON_NULL, -1 indicates that we are in a recursion, where flow info is ignored
-protected int findNullTypeAnnotationMismatch(TypeBinding requiredType, TypeBinding providedType, int nullStatus) {
- int severity = 0;
- if (requiredType instanceof ArrayBinding) {
- long[] requiredDimsTagBits = ((ArrayBinding)requiredType).nullTagBitsPerDimension;
- if (requiredDimsTagBits != null) {
- int dims = requiredType.dimensions();
- if (requiredType.dimensions() == providedType.dimensions()) {
- long[] providedDimsTagBits = ((ArrayBinding)providedType).nullTagBitsPerDimension;
- if (providedDimsTagBits == null) {
- severity = 1; // required is annotated, provided not, need unchecked conversion
- } else {
- for (int i=0; i<dims; i++) {
- long requiredBits = requiredDimsTagBits[i] & TagBits.AnnotationNullMASK;
- long providedBits = providedDimsTagBits[i] & TagBits.AnnotationNullMASK;
- if (i > 0)
- nullStatus = -1; // don't use beyond the outermost dimension
- severity = Math.max(severity, computeNullProblemSeverity(requiredBits, providedBits, nullStatus));
- if (severity == 2)
- return severity;
- }
- }
- } else if (providedType.id == TypeIds.T_null) {
- if (dims > 0 && requiredDimsTagBits[0] == TagBits.AnnotationNonNull)
- return 2;
- }
- }
- } else if (requiredType instanceof ParameterizedTypeBinding) {
- long requiredBits = requiredType.tagBits & TagBits.AnnotationNullMASK;
- if (requiredBits != TagBits.AnnotationNullable // nullable lhs accepts everything, ...
- || nullStatus == -1) // only at detail/recursion even nullable must be matched exactly
- {
- long providedBits = providedType.tagBits & TagBits.AnnotationNullMASK;
- severity = computeNullProblemSeverity(requiredBits, providedBits, nullStatus);
- }
- if (severity < 3) {
- if (providedType.isParameterizedType()) { // TODO(stephan): handle providedType.isRaw()
- TypeBinding[] requiredArguments = ((ParameterizedTypeBinding) requiredType).arguments;
- TypeBinding[] providedArguments = ((ParameterizedTypeBinding) providedType).arguments;
- if (requiredArguments != null && providedArguments != null && requiredArguments.length == providedArguments.length) {
- for (int i = 0; i < requiredArguments.length; i++) {
- severity = Math.max(severity, findNullTypeAnnotationMismatch(requiredArguments[i], providedArguments[i], -1));
- if (severity == 2)
- return severity;
- }
- }
- }
- TypeBinding requiredEnclosing = requiredType.enclosingType();
- TypeBinding providedEnclosing = providedType.enclosingType();
- if (requiredEnclosing != null && providedEnclosing != null)
- severity = Math.max(severity, findNullTypeAnnotationMismatch(requiredEnclosing, providedEnclosing, -1));
- }
- }
- return severity;
-}
-static int computeNullProblemSeverity(long requiredBits, long providedBits, int nullStatus) {
- if (requiredBits != 0 && requiredBits != providedBits) {
- if (providedBits != 0) {
- return 2; // mismatching annotations
- } else {
- if (requiredBits == TagBits.AnnotationNonNull && nullStatus == FlowInfo.NON_NULL) {
- return 0; // OK by flow analysis
- }
- return 1; // need unchecked conversion regarding type detail
- }
- }
- return 0; // OK by tagBits
-}
/**
* INTERNAL USE ONLY.
* This is used to redirect inter-statements jumps.
@@ -329,7 +229,7 @@
// called with (argLength - lastIndex) elements : foo(1, 2) or foo(1, 2, 3, 4)
// need to gen elements into an array, then gen each remaining element into created array
codeStream.generateInlinedValue(argLength - varArgIndex);
- codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
+ codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
for (int i = varArgIndex; i < argLength; i++) {
codeStream.dup();
codeStream.generateInlinedValue(i - varArgIndex);
@@ -348,7 +248,7 @@
// right number but not directly compatible or too many arguments - wrap extra into array
// need to gen elements into an array, then gen each remaining element into created array
codeStream.generateInlinedValue(1);
- codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
+ codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
codeStream.dup();
codeStream.generateInlinedValue(0);
arguments[varArgIndex].generateCode(currentScope, codeStream, true);
@@ -358,7 +258,7 @@
// scenario: foo(1) --> foo(1, new int[0])
// generate code for an empty array of parameterType
codeStream.generateInlinedValue(0);
- codeStream.newArray(null, codeGenVarArgsType); // create a mono-dimensional array
+ codeStream.newArray(codeGenVarArgsType); // create a mono-dimensional array
}
} else if (arguments != null) { // standard generation for method arguments
//{ObjectTeams: decapsulation under OTREDyn requires packing into an array etc.:
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 9860285..c7fe26b 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
@@ -16,7 +16,8 @@
* Stephan Herrmann - Contributions for
* Bug 360328 - [compiler][null] detect null problems in nested code (local class inside a loop)
* Bug 388630 - @NonNull diagnostics at line 0
- * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
* Keigo Imai - Contribution for bug 388903 - Cannot extend inner class as an anonymous class when it extends the outer class
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -1805,11 +1806,6 @@
boolean hasEnumConstants = false;
FieldDeclaration[] enumConstantsWithoutBody = null;
- if (this.typeParameters != null) {
- for (int i = 0, count = this.typeParameters.length; i < count; i++) {
- this.typeParameters[i].resolve(this.scope);
- }
- }
if (this.memberTypes != null) {
//{ObjectTeams: don't cache count, array may grow during this loop!
/* orig:
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
index 020c1d3..4eb533a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java
@@ -14,6 +14,7 @@
* Technical University Berlin - extended API and implementation
* Stephan Herrmann - Contribution for
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
+ * Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 415543 - [1.8][compiler] Incorrect bound index in RuntimeInvisibleTypeAnnotations attribute
*******************************************************************************/
@@ -141,7 +142,7 @@
if (resolutionScope != null) {
resolveAnnotations(resolutionScope, this.annotations, new Annotation.TypeUseBinding(Binding.TYPE_PARAMETER));
if (this.binding != null && this.binding.isValidBinding())
- this.binding.evaluateNullAnnotations(this.annotations);
+ this.binding.evaluateNullAnnotations(scope, this);
}
}
/* (non-Javadoc)
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 0a5ecd6..4720947 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
@@ -18,6 +18,7 @@
* bug 392862 - [1.8][compiler][null] Evaluate null annotations on array types
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
@@ -33,6 +34,7 @@
import org.eclipse.jdt.internal.codeassist.select.SelectionNodeFound;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext;
import org.eclipse.jdt.internal.compiler.codegen.AnnotationTargetTypeConstants;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
@@ -727,7 +729,7 @@
long[] tagBitsPerDimension = null;
int dimensions = this.dimensions();
boolean evalNullAnnotations = scope.compilerOptions().isAnnotationBasedNullAnalysisEnabled;
- boolean isArrayReference = this instanceof ArrayTypeReference && dimensions > 0;
+ boolean isArrayReference = dimensions > 0;
if (this.annotations != null) {
int annotationsLevels = this.annotations.length;
for (int i = 0; i < annotationsLevels; i++) {
@@ -739,13 +741,16 @@
for (int j=0; j<len; j++) {
Binding recipient = currentAnnotations[j].recipient;
if (recipient instanceof Annotation.TypeUseBinding) {
- if (isArrayReference) {
- if (tagBitsPerDimension == null)
- tagBitsPerDimension = new long[dimensions+1]; // each dimension plus leaf component type at last position
- // @NonNull Foo [][][] means the leaf component type is @NonNull:
- tagBitsPerDimension[dimensions] = ((Annotation.TypeUseBinding)recipient).tagBits & TagBits.AnnotationNullMASK;
- } else {
- tagBits |= ((Annotation.TypeUseBinding)recipient).tagBits & TagBits.AnnotationNullMASK;
+ long nullTagBits = ((Annotation.TypeUseBinding)recipient).tagBits & TagBits.AnnotationNullMASK;
+ if (nullTagBits != 0) {
+ if (isArrayReference) {
+ if (tagBitsPerDimension == null)
+ tagBitsPerDimension = new long[dimensions+1]; // each dimension plus leaf component type at last position
+ // @NonNull Foo [][][] means the leaf component type is @NonNull:
+ tagBitsPerDimension[dimensions] = nullTagBits;
+ } else {
+ tagBits |= nullTagBits;
+ }
}
}
}
@@ -764,9 +769,12 @@
for (int j=0; j<len; j++) {
Binding recipient = dimensionAnnotations[j].recipient;
if (recipient instanceof Annotation.TypeUseBinding) {
- if (tagBitsPerDimension == null)
- tagBitsPerDimension = new long[dimensions+1];
- tagBitsPerDimension[i] = ((Annotation.TypeUseBinding)recipient).tagBits & TagBits.AnnotationNullMASK;
+ long nullTagBits = ((Annotation.TypeUseBinding)recipient).tagBits & TagBits.AnnotationNullMASK;
+ if (nullTagBits != 0) {
+ if (tagBitsPerDimension == null)
+ tagBitsPerDimension = new long[dimensions+1];
+ tagBitsPerDimension[i] = nullTagBits;
+ }
}
}
}
@@ -796,36 +804,45 @@
public int getAnnotatableLevels() {
return 1;
}
-// If typeArgumentAnnotations contain any that are evaluated by the compiler
-// create/retrieve a parameterized type binding
-// capturing the effect of these annotations into the resolved type binding.
-protected TypeBinding captureTypeAnnotations(Scope scope, ReferenceBinding enclosingType, TypeBinding argType, Annotation[] typeArgumentAnnotations) {
- if (!scope.compilerOptions().isAnnotationBasedNullAnalysisEnabled
- || typeArgumentAnnotations == null
- || !(argType instanceof ReferenceBinding))
+/** Check all typeArguments against null constraints on their corresponding type variables. */
+protected void checkNullConstraints(Scope scope, TypeReference[] typeArguments) {
+ CompilerOptions compilerOptions = scope.compilerOptions();
+ if (compilerOptions.isAnnotationBasedNullAnalysisEnabled
+ && compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8
+ && typeArguments != null)
{
- return argType;
+ TypeVariableBinding[] typeVariables = this.resolvedType.original().typeVariables();
+ for (int i = 0; i < typeArguments.length; i++) {
+ TypeReference arg = typeArguments[i];
+ if (arg.resolvedType != null && arg.resolvedType.hasNullTypeAnnotations())
+ arg.checkNullConstraints(scope, typeVariables, i);
+ }
}
- int annotLen = typeArgumentAnnotations.length;
- long annotationBits = 0L;
- for (int i = 0; i < annotLen; i++) {
- if (typeArgumentAnnotations[i] instanceof MarkerAnnotation) {
- AnnotationBinding compilerAnnotation = ((MarkerAnnotation)typeArgumentAnnotations[i]).getCompilerAnnotation();
- if (compilerAnnotation != null) {
- switch (compilerAnnotation.getAnnotationType().id) {
- case TypeIds.T_ConfiguredAnnotationNonNull :
- annotationBits |= TagBits.AnnotationNonNull;
- break;
- case TypeIds.T_ConfiguredAnnotationNullable :
- annotationBits |= TagBits.AnnotationNullable;
- break;
- default: // no other annotations are currently handled
- }
+}
+/** Check whether this type reference conforms to all null constraints defined for any of the given type variables. */
+protected void checkNullConstraints(Scope scope, TypeBinding[] variables, int rank) {
+ if (variables != null && variables.length > rank) {
+ if (variables[rank].hasNullTypeAnnotations()) {
+ if ((this.resolvedType.tagBits & TagBits.AnnotationNullMASK) != (variables[rank].tagBits & TagBits.AnnotationNullMASK)) {
+ scope.problemReporter().nullityMismatchTypeArgument(variables[rank], this.resolvedType, this);
+ }
+ }
+ }
+}
+/** Retrieve the null annotation that has been translated to the given nullTagBits. */
+public Annotation findAnnotation(long nullTagBits) {
+ if (this.annotations != null) {
+ Annotation[] innerAnnotations = this.annotations[this.annotations.length-1];
+ if (innerAnnotations != null) {
+ int annId = nullTagBits == TagBits.AnnotationNonNull ? TypeIds.T_ConfiguredAnnotationNonNull : TypeIds.T_ConfiguredAnnotationNullable;
+ for (int i = 0; i < innerAnnotations.length; i++) {
+ if (innerAnnotations[i] != null
+ && innerAnnotations[i].resolvedType != null
+ && innerAnnotations[i].resolvedType.id == annId)
+ return innerAnnotations[i];
}
}
}
- if (annotationBits == 0L)
- return argType;
- return scope.environment().createAnnotatedType(argType, annotationBits);
+ return null;
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java
index 57ce687..5235cde 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java
@@ -13,6 +13,8 @@
* IBM Corporation - initial API and implementation
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 415397 - [1.8][compiler] Type Annotations on wildcard type argument dropped
+ * Stephan Herrmann - Contribution for
+ * Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
@@ -61,7 +63,6 @@
private TypeBinding internalResolveType(Scope scope, ReferenceBinding genericType, int rank) {
TypeBinding boundType = null;
- resolveAnnotations(scope);
if (this.bound != null) {
boundType = scope.kind == Scope.CLASS_SCOPE
? this.bound.resolveType((ClassScope)scope)
@@ -71,8 +72,17 @@
return null;
}
}
- WildcardBinding wildcard = scope.environment().createWildcard(genericType, rank, boundType, null /*no extra bound*/, this.kind);
- return this.resolvedType = wildcard;
+ this.resolvedType = scope.environment().createWildcard(genericType, rank, boundType, null /*no extra bound*/, this.kind);
+ resolveAnnotations(scope);
+ if (boundType != null && boundType.hasNullTypeAnnotations() && this.resolvedType.hasNullTypeAnnotations()) {
+ if (((boundType.tagBits | this.resolvedType.tagBits) & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK) { // are both set?
+ Annotation annotation = this.bound.findAnnotation(boundType.tagBits & TagBits.AnnotationNullMASK);
+ scope.problemReporter().contradictoryNullAnnotationsOnBounds(annotation, this.resolvedType.tagBits);
+ this.resolvedType = this.resolvedType.unannotated();
+ this.bound.resolvedType = ((WildcardBinding)this.resolvedType).bound = boundType.unannotated();
+ }
+ }
+ return this.resolvedType;
}
public StringBuffer printExpression(int indent, StringBuffer output){
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 6d3c1a7..2525bb8 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
@@ -15,6 +15,7 @@
* Technical University Berlin - extended API and implementation
* Jesper S Moller - Contributions for
* Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335
+ * Bug 406982 - [1.8][compiler] Generation of MethodParameters Attribute in classfile
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.classfmt;
@@ -63,6 +64,13 @@
// SH}
/**
+ * From classfile version 52 (compliance 1.8 up), meaning that a formal parameter is mandated
+ * by a language specification, so all compilers for the language must emit it.
+ */
+ int AccMandated = 0x8000;
+
+
+ /**
* Other VM flags.
*/
int AccSuper = 0x0020;
@@ -166,4 +174,5 @@
int ATTR_STACK_MAP_TABLE = 0x8; // Stack map table attribute
int ATTR_STACK_MAP = 0x10; // Stack map attribute: cldc
int ATTR_TYPE_ANNOTATION = 0x20; // type annotation attribute (jsr 308)
+ int ATTR_METHOD_PARAMETERS = 0x40; // method parameters attribute (jep 118)
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
index 27f4ea2..d472880 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java
@@ -22,7 +22,7 @@
this.parameterAnnotations = parameterAnnotations;
}
public IBinaryAnnotation[] getParameterAnnotations(int index) {
- return this.parameterAnnotations[index];
+ return this.parameterAnnotations == null ? null : this.parameterAnnotations[index];
}
public int getAnnotatedParametersCount() {
return this.parameterAnnotations == null ? 0 : this.parameterAnnotations.length;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationWalker.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationWalker.java
index 2ad88f4..1b7b52e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationWalker.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationWalker.java
@@ -250,6 +250,23 @@
return restrict(newMatches, this.pathPtr+2);
}
+ /** Walk to the bound of a wildcard. */
+ public TypeAnnotationWalker toWildcardBound() {
+ long newMatches = this.matches;
+ if (newMatches == 0)
+ return EMPTY_ANNOTATION_WALKER;
+ int length = this.typeAnnotations.length;
+ for (int i = 0, mask = 1; i < length; i++, mask = mask << 1) {
+ IBinaryTypeAnnotation candidate = this.typeAnnotations[i];
+ int[] path = candidate.getTypePath();
+ if (this.pathPtr >= path.length
+ || path[this.pathPtr] != AnnotationTargetTypeConstants.WILDCARD_BOUND) {
+ newMatches &= ~mask;
+ }
+ }
+ return restrict(newMatches, this.pathPtr+2);
+ }
+
/**
* Descend down one level of array dimensions.
*/
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
index ac35f8f..06905c1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java
@@ -26,6 +26,7 @@
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
* Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.codegen;
@@ -1938,7 +1939,7 @@
invokeClassForName();
int paramLength = methodBinding.parameters.length;
this.generateInlinedValue(paramLength);
- newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
+ newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
if (paramLength > 0) {
dup();
for (int i = 0; i < paramLength; i++) {
@@ -1994,7 +1995,7 @@
this.ldc(String.valueOf(methodBinding.selector));
int paramLength = methodBinding.parameters.length;
this.generateInlinedValue(paramLength);
- newArray(null, scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
+ newArray(scope.createArrayType(scope.getType(TypeConstants.JAVA_LANG_CLASS, 3), 1));
if (paramLength > 0) {
dup();
for (int i = 0; i < paramLength; i++) {
@@ -2601,7 +2602,7 @@
arraylength();
dup();
istore_1();
- newArray(null, (ArrayBinding) enumArray);
+ newArray((ArrayBinding) enumArray);
dup();
astore_2();
iconst_0();
@@ -5982,10 +5983,6 @@
}
public void newArray(ArrayBinding arrayBinding) {
- this.newArray(null, arrayBinding);
-}
-
-public void newArray(TypeReference typeReference, ArrayBinding arrayBinding) {
this.newArray(null, null, arrayBinding);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
index d9ef873..85246d2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java
@@ -13,6 +13,8 @@
* IBM Corporation - initial API and implementation
* Jesper S Moller - Contributions for
* Bug 405066 - [1.8][compiler][codegen] Implement code generation infrastructure for JSR335
+ * Bug 406982 - [1.8][compiler] Generation of MethodParameters Attribute in classfile
+ * Bug 416885 - [1.8][compiler]IncompatibleClassChange error (edit)
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.codegen;
@@ -86,6 +88,8 @@
public static final char[] doubleDoubleSignature = "(D)Ljava/lang/Double;".toCharArray(); //$NON-NLS-1$
public static final char[] DOUBLEVALUE_DOUBLE_METHOD_NAME = "doubleValue".toCharArray(); //$NON-NLS-1$
public static final char[] DOUBLEVALUE_DOUBLE_METHOD_SIGNATURE = "()D".toCharArray(); //$NON-NLS-1$
+ public static final char[] EnumName = "$enum$name".toCharArray();//$NON-NLS-1$
+ public static final char[] EnumOrdinal = "$enum$ordinal".toCharArray();//$NON-NLS-1$
public static final char[] Exit = "exit".toCharArray(); //$NON-NLS-1$
public static final char[] ExitIntSignature = "(I)V".toCharArray(); //$NON-NLS-1$
public static final char[] FloatConstrSignature = "(F)V".toCharArray(); //$NON-NLS-1$
@@ -181,6 +185,7 @@
public static final char[] longLongSignature = "(J)Ljava/lang/Long;".toCharArray(); //$NON-NLS-1$
public static final char[] LONGVALUE_LONG_METHOD_NAME = "longValue".toCharArray(); //$NON-NLS-1$
public static final char[] LONGVALUE_LONG_METHOD_SIGNATURE = "()J".toCharArray(); //$NON-NLS-1$
+ public static final char[] Name = "name".toCharArray();//$NON-NLS-1$
public static final char[] NewInstance = "newInstance".toCharArray(); //$NON-NLS-1$
public static final char[] NewInstanceSignature = "(Ljava/lang/Class;[I)Ljava/lang/Object;".toCharArray(); //$NON-NLS-1$
public static final char[] Next = "next".toCharArray();//$NON-NLS-1$
@@ -256,8 +261,8 @@
// java 7 java.lang.invoke.MethodHandle.invokeExact(..)/invokeGeneric(..)
public static final char[] JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE = "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".toCharArray(); //$NON-NLS-1$
// Java 8 lambda support
- public static final char[] METAFACTORY = "metaFactory".toCharArray(); //$NON-NLS-1$
- public static final char[] JAVA_LANG_INVOKE_LAMBDAMETAFACTORY_METAFACTORY_SIGNATURE = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;".toCharArray(); //$NON-NLS-1$
+ public static final char[] METAFACTORY = "metafactory".toCharArray(); //$NON-NLS-1$
+ public static final char[] JAVA_LANG_INVOKE_LAMBDAMETAFACTORY_METAFACTORY_SIGNATURE = "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite;".toCharArray(); //$NON-NLS-1$
public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$
public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java
index 9d2e842..bc66e5b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java
@@ -15,6 +15,7 @@
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409247 - [1.8][compiler] Verify error with code allocating multidimensional array
* Bug 409517 - [1.8][compiler] Type annotation problems on more elaborate array references
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.codegen;
@@ -98,7 +99,7 @@
: AnnotationTargetTypeConstants.METHOD_INVOCATION_TYPE_ARGUMENT;
for (int i = 0, max = typeArguments.length; i < max; i++) {
TypeReference typeArgument = typeArguments[i];
- if ((typeArgument.bits & ASTNode.HasTypeAnnotations) != 0) { // TODO can check this at a higher level?
+ if ((typeArgument.bits & ASTNode.HasTypeAnnotations) != 0) {
addAnnotationContext(typeArgument, this.position, i, targetType);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java
index d918879..b9cf625 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * 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
@@ -15,6 +19,8 @@
* bug 385626 - @NonNull fails across loop boundaries
* bug 388996 - [compiler][resource] Incorrect 'potential resource leak'
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
+ * Jesper S Moller - Contributions for
+ * bug 404657 - [1.8][compiler] Analysis for effectively final variables fails to consider loops
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.flow;
@@ -25,6 +31,7 @@
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding;
@@ -77,10 +84,13 @@
} else {
// final local variable
if (flowInfo.isPotentiallyAssigned((LocalVariableBinding)variable)) {
- complained = true;
- scope.problemReporter().duplicateInitializationOfFinalLocal(
- (LocalVariableBinding) variable,
- this.finalAssignments[i]);
+ variable.tagBits &= ~TagBits.IsEffectivelyFinal;
+ if (variable.isFinal()) {
+ complained = true;
+ scope.problemReporter().duplicateInitializationOfFinalLocal(
+ (LocalVariableBinding) variable,
+ this.finalAssignments[i]);
+ }
}
}
// any reference reported at this level is removed from the parent context
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
index 5729c84..3379caf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java
@@ -4,7 +4,10 @@
* 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
- * $Id: FlowInfo.java 23404 2010-02-03 14:10:22Z stephan $
+ *
+ * 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
@@ -14,6 +17,7 @@
* bug 292478 - Report potentially null across variable assignment
* bug 332637 - Dead Code detection removing code that isn't dead
* bug 394768 - [compiler][resource] Incorrect resource leak warning when creating stream in conditional
+ * Bug 411964 - [1.8][null] leverage null type annotation in foreach statement
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.flow;
@@ -21,6 +25,7 @@
import org.eclipse.jdt.internal.compiler.ast.IfStatement;
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.eclipse.objectteams.otdt.internal.core.compiler.ast.BaseCallTrackingVariable;
/**
@@ -667,6 +672,18 @@
*/
abstract public void resetAssignmentInfo(LocalVariableBinding local);
+/**
+ * Check whether 'tagBits' contains either {@link TagBits#AnnotationNonNull} or {@link TagBits#AnnotationNullable},
+ * and answer the corresponding null status ({@link #NON_NULL} etc.).
+ */
+public static int tagBitsToNullStatus(long tagBits) {
+ if ((tagBits & TagBits.AnnotationNonNull) != 0)
+ return NON_NULL;
+ if ((tagBits & TagBits.AnnotationNullable) != 0)
+ return POTENTIALLY_NULL | POTENTIALLY_NON_NULL;
+ return UNKNOWN;
+}
+
//{ObjectTeams:
public boolean isDefinitelyAssigned(BaseCallTrackingVariable baseCallTrackingVariable)
{
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
index 2befb45..c3927d2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * 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
@@ -18,6 +22,8 @@
* bug 376263 - Bogus "Potential null pointer access" warning
* bug 403147 - [compiler][null] FUP of bug 400761: consolidate interaction between unboxing, NPE, and deferred checking
* bug 406384 - Internal error with I20130413
+ * Jesper S Moller - contributions for
+ * bug 404657 - [1.8][compiler] Analysis for effectively final variables fails to consider loops
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.flow;
@@ -33,6 +39,7 @@
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.jdt.internal.compiler.lookup.TagBits;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
import org.eclipse.jdt.internal.compiler.lookup.VariableBinding;
@@ -120,10 +127,13 @@
}
} else {
if (flowInfo.isPotentiallyAssigned((LocalVariableBinding)variable)) {
- complained = true;
- scope.problemReporter().duplicateInitializationOfFinalLocal(
- (LocalVariableBinding) variable,
- this.finalAssignments[i]);
+ variable.tagBits &= ~TagBits.IsEffectivelyFinal;
+ if (variable.isFinal()) {
+ complained = true;
+ scope.problemReporter().duplicateInitializationOfFinalLocal(
+ (LocalVariableBinding) variable,
+ this.finalAssignments[i]);
+ }
}
}
// any reference reported at this level is removed from the parent context where it
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 5e36e90..4e04c12 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
@@ -1552,6 +1552,8 @@
// indicates if unused/optimizable local variables need to be preserved (debugging purpose)
this.preserveAllLocalVariables = false;
+
+ this.produceMethodParameters = false;
// indicates whether literal expressions are inlined at parse-time or not
this.parseLiteralExpressionsAsConstants = true;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
index 0d5deb4..ff4179e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java
@@ -18,6 +18,8 @@
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -203,6 +205,13 @@
/* Answer true if the receiver type can be assigned to the argument type (right)
*/
public boolean isCompatibleWith(TypeBinding otherType, Scope captureScope) {
+ // disregard any type annotations on this and otherType
+ // recursive call needed when this is annotated, unless the annotation was introduced on a declaration
+ otherType = otherType.unannotated();
+ TypeBinding unannotated = unannotated();
+ if (unannotated != this)
+ return unannotated.isCompatibleWith(otherType, captureScope);
+
if (this == otherType)
return true;
@@ -353,6 +362,8 @@
return this.leafComponentType != null ? debugName() : "NULL TYPE ARRAY"; //$NON-NLS-1$
}
public TypeBinding unannotated() {
+ if (this.nullTagBitsPerDimension == null)
+ return this;
return this.environment.createArrayType(this.leafComponentType, this.dimensions);
}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
index b303830..533f78c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java
@@ -26,6 +26,9 @@
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Jesper Steen Moller - Contributions for
+ * Bug 412150 [1.8] [compiler] Enable reflected parameter names during annotation processing
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -119,6 +122,8 @@
public class BinaryTypeBinding extends ReferenceBinding {
+ private static final IBinaryMethod[] NO_BINARY_METHODS = new IBinaryMethod[0];
+
// all of these fields are ONLY guaranteed to be initialized if accessed using their public accessor method
protected ReferenceBinding superclass;
protected ReferenceBinding enclosingType;
@@ -572,8 +577,9 @@
}
if (needFieldsAndMethods) {
- createFields(binaryType.getFields(), sourceLevel, missingTypeNames);
- createMethods(binaryType.getMethods(), sourceLevel, missingTypeNames);
+ IBinaryField[] iFields = binaryType.getFields();
+ createFields(iFields, sourceLevel, missingTypeNames);
+ IBinaryMethod[] iMethods = createMethods(binaryType.getMethods(), sourceLevel, missingTypeNames);
boolean isViewedAsDeprecated = isViewedAsDeprecated();
if (isViewedAsDeprecated) {
for (int i = 0, max = this.fields.length; i < max; i++) {
@@ -589,6 +595,19 @@
}
}
}
+ if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) {
+ // need annotations on the type before processing null annotations on members respecting any @NonNullByDefault:
+ scanTypeForNullDefaultAnnotation(binaryType, this.fPackage, this);
+
+ if (iFields != null) {
+ for (int i = 0; i < iFields.length; i++)
+ scanFieldForNullAnnotation(iFields[i], this.fields[i]);
+ }
+ if (iMethods != null) {
+ for (int i = 0; i < iMethods.length; i++)
+ scanMethodForNullAnnotation(iMethods[i], this.methods[i]);
+ }
+ }
}
//{ObjectTeams: now this type is setup enough to evaluate attributes
if (binaryType instanceof ClassFileReader) {
@@ -669,12 +688,6 @@
this.fields[i].setAnnotations(createAnnotations(binaryField.getAnnotations(), this.environment, missingTypeNames));
}
}
- if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) {
- for (int i = 0; i <size; i++) {
- IBinaryField binaryField = iFields[i];
- scanFieldForNullAnnotation(binaryField, this.fields[i]);
- }
- }
}
}
}
@@ -726,6 +739,8 @@
AnnotationBinding[][] paramAnnotations = null;
TypeBinding returnType = null;
+ char[][] argumentNames = method.getArgumentNames();
+
final boolean use15specifics = sourceLevel >= ClassFileConstants.JDK1_5;
/* https://bugs.eclipse.org/bugs/show_bug.cgi?id=324850, Since a 1.4 project can have a 1.5
type as a super type and the 1.5 type could be generic, we must internalize usages of type
@@ -808,6 +823,19 @@
if (!method.isConstructor())
returnType = this.environment.getTypeFromSignature(methodDescriptor, index + 1, -1, false, this, missingTypeNames, walker.toMethodReturn()); // index is currently pointing at the ')'
+
+ final int argumentNamesLength = argumentNames == null ? 0 : argumentNames.length;
+ if (startIndex > 0 && argumentNamesLength > 0) {
+ // We'll have to slice the starting arguments off
+ if (startIndex >= argumentNamesLength) {
+ argumentNames = Binding.NO_PARAMETER_NAMES; // We know nothing about the argument names
+ } else {
+ char[][] slicedArgumentNames = new char[argumentNamesLength - startIndex][];
+ System.arraycopy(argumentNames, startIndex, slicedArgumentNames, 0, argumentNamesLength - startIndex);
+ argumentNames = slicedArgumentNames;
+ }
+ }
+
} else {
methodModifiers |= ExtraCompilerModifiers.AccGenericSignature;
// MethodTypeSignature = ParameterPart(optional) '(' TypeSignatures ')' return_typeSignature ['^' TypeSignature (optional)]
@@ -888,6 +916,8 @@
isAnnotationType() ? convertMemberValue(method.getDefaultValue(), this.environment, missingTypeNames) : null,
this.environment);
+ if (argumentNames != null) result.parameterNames = argumentNames;
+
if (use15specifics)
result.tagBits |= method.getTagBits();
result.typeVariables = typeVars;
@@ -940,15 +970,15 @@
}
// SH}
- scanMethodForNullAnnotation(method, result);
-
return result;
}
/**
* Create method bindings for binary type, filtering out <clinit> and synthetics
+ * As some iMethods may be ignored in this process we return the matching array of those
+ * iMethods for which MethodBindings have been created; indices match those in this.methods.
*/
-private void createMethods(IBinaryMethod[] iMethods, long sourceLevel, char[][][] missingTypeNames) {
+private IBinaryMethod[] createMethods(IBinaryMethod[] iMethods, long sourceLevel, char[][][] missingTypeNames) {
int total = 0, initialTotal = 0, iClinit = -1;
int[] toSkip = null;
if (iMethods != null) {
@@ -979,7 +1009,7 @@
}
if (total == 0) {
this.methods = Binding.NO_METHODS;
- return;
+ return NO_BINARY_METHODS;
}
boolean hasRestrictedAccess = hasRestrictedAccess();
@@ -991,15 +1021,19 @@
method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
this.methods[i] = method;
}
+ return iMethods;
} else {
+ IBinaryMethod[] mappedBinaryMethods = new IBinaryMethod[total];
for (int i = 0, index = 0; i < initialTotal; i++) {
if (iClinit != i && (toSkip == null || toSkip[i] != -1)) {
MethodBinding method = createMethod(iMethods[i], sourceLevel, missingTypeNames);
if (hasRestrictedAccess)
method.modifiers |= ExtraCompilerModifiers.AccRestrictedAccess;
+ mappedBinaryMethods[index] = iMethods[i];
this.methods[index++] = method;
}
}
+ return mappedBinaryMethods;
}
}
//{ObjectTeams: create bindings for OTRE-generated methods:
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
index dd8ed71..ecb74a1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java
@@ -15,6 +15,8 @@
* Technical University Berlin - extended API and implementation
* Stephan Herrmann - Contribution for
* bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults
+ * Jesper Steen Moller - Contributions for
+ * Bug 412150 [1.8] [compiler] Enable reflected parameter names during annotation processing
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -70,6 +72,7 @@
public static final TypeVariableBinding[] NO_TYPE_VARIABLES = new TypeVariableBinding[0];
public static final AnnotationBinding[] NO_ANNOTATIONS = new AnnotationBinding[0];
public static final ElementValuePair[] NO_ELEMENT_VALUE_PAIRS = new ElementValuePair[0];
+ public static final char[][] NO_PARAMETER_NAMES = new char[0][];
//{ObjectTeams
public static final CallinCalloutBinding[] NO_CALLIN_CALLOUT_BINDINGS = new CallinCalloutBinding[0];
public static final SyntheticArgumentBinding[] NO_SYNTH_ARGUMENTS = new SyntheticArgumentBinding[0];
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
index 6e2e51a..be686c2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java
@@ -5,6 +5,10 @@
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
+ * 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
@@ -17,6 +21,7 @@
* Bug 358903 - Filter practically unimportant resource leak warnings
* Bug 395977 - [compiler][resource] Resource leak warning behavior possibly incorrect for anonymous inner class
* Bug 395002 - Self bound generic class doesn't resolve bounds properly for wildcards for certain parametrisation.
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -913,6 +918,10 @@
}
//Markus Witte}
+ void resolveTypeParameter(TypeParameter typeParameter) {
+ typeParameter.resolve(this);
+ }
+
private void checkAndSetModifiers() {
SourceTypeBinding sourceType = this.referenceContext.binding;
int modifiers = sourceType.modifiers;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java
index f69fb29..aa902a2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java
@@ -98,6 +98,11 @@
if (isInstanceMethod) {
List superMethodList = new ArrayList();
+ // need super types connected:
+ if (currentType instanceof SourceTypeBinding && !currentType.isHierarchyConnected() && !currentType.isAnonymousType()) {
+ ((SourceTypeBinding) currentType).scope.connectTypeHierarchy();
+ }
+
int paramLen = currentMethod.parameters.length;
findAllOverriddenMethods(currentMethod.original(), currentMethod.selector, paramLen,
currentType, new HashSet(), superMethodList);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
index fbc7326..7b26590 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java
@@ -22,6 +22,11 @@
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 416183 - [1.8][compiler][null] Overload resolution fails with null annotations
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -35,9 +40,7 @@
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ClassFilePool;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
-import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.classfmt.TypeAnnotationWalker;
@@ -897,7 +900,7 @@
if (currentBinding == null) // no matching array, but space left
return arrayBindings[index] = new ArrayBinding(leafComponentType, dimensionCount, this, nullTagBitsPerDimension);
if (currentBinding.leafComponentType == leafComponentType
- && (nullTagBitsPerDimension == null || Arrays.equals(currentBinding.nullTagBitsPerDimension, nullTagBitsPerDimension)))
+ && Arrays.equals(currentBinding.nullTagBitsPerDimension, nullTagBitsPerDimension))
return currentBinding;
}
@@ -972,9 +975,6 @@
}
packageBinding.addType(binaryBinding);
setAccessRestriction(binaryBinding, accessRestriction);
- // need type annotations before processing methods (for @NonNullByDefault)
- if (this.globalOptions.isAnnotationBasedNullAnalysisEnabled)
- binaryBinding.scanTypeForNullDefaultAnnotation(binaryType, packageBinding, binaryBinding);
binaryBinding.cachePartsFrom(binaryType, needFieldsAndMethods);
return binaryBinding;
}
@@ -1236,7 +1236,7 @@
}
if (genericType instanceof ReferenceBinding) {
TypeBinding[] typeArguments = genericType.isParameterizedType() ? ((ParameterizedTypeBinding) genericType).arguments : null;
- ParameterizedTypeBinding parameterizedType = createParameterizedType((ReferenceBinding) genericType, typeArguments,
+ ParameterizedTypeBinding parameterizedType = createParameterizedType((ReferenceBinding) genericType.original(), typeArguments,
annotationBits, genericType.enclosingType());
parameterizedType.id = genericType.id; // for well-known types shared the id (only here since those types are not generic, are they?)
return parameterizedType;
@@ -1249,41 +1249,50 @@
return createArrayType(genericType.leafComponentType(), genericType.dimensions(), tagBitsPerDims);
}
}
- // TODO(stephan): PolyTypeBinding
return genericType;
}
/**
- * Create an annotated type from 'type' by applying 'annotationBits' to its outermost enclosing type.
- * This is used for those locations where a null annotations was parsed as a declaration annotation
- * and later must be pushed into the type.
- * @param type
- * @param annotationBits
+ * After an 'annotatedType' has been substituted yielding 'unannotatedSubstitute,
+ * use this method to re-apply the null type annotations from 'annotatedType' to the substitute.
+ * We assume that both types are structurally equivalent.
*/
-public TypeBinding pushAnnotationIntoType(TypeBinding type, TypeReference typeRef, long annotationBits) {
- TypeBinding outermostType = type;
- if (typeRef instanceof QualifiedTypeReference) {
- int depth = typeRef.getAnnotatableLevels();
- while (--depth > 0)
- outermostType = outermostType.enclosingType();
- }
- if ((outermostType.tagBits & TagBits.AnnotationNullMASK) != annotationBits) {
- if (type == outermostType)
- return createAnnotatedType(type, annotationBits);
- // types with true enclosingType() must be ReferenceBindings
- return reWrap((ReferenceBinding) type, outermostType, (ReferenceBinding)createAnnotatedType(outermostType, annotationBits));
- }
- return type;
-}
+public TypeBinding copyAnnotations(TypeBinding annotatedType, TypeBinding unannotatedSubstitute) {
+ if (!annotatedType.hasNullTypeAnnotations())
+ return unannotatedSubstitute;
-private ReferenceBinding reWrap(ReferenceBinding inner, TypeBinding outer, ReferenceBinding annotatedOuter) {
- ReferenceBinding annotatedEnclosing = (inner.enclosingType() == outer)
- ? annotatedOuter
- : reWrap(inner.enclosingType(), outer, annotatedOuter);
- TypeBinding[] arguments = (inner instanceof ParameterizedTypeBinding)
- ? ((ParameterizedTypeBinding) inner).arguments
- : Binding.NO_TYPES;
- return createParameterizedType((ReferenceBinding)inner.original(), arguments, inner.tagBits, annotatedEnclosing);
+ // FIXME(stephan): what if both types have (some) null annotations??
+ if (unannotatedSubstitute instanceof ReferenceBinding) {
+ TypeBinding[] newArguments = null;
+ if (annotatedType.isParameterizedType() && unannotatedSubstitute.isParameterizedType()) {
+ ParameterizedTypeBinding unannotatedPTB = (ParameterizedTypeBinding) unannotatedSubstitute;
+ ParameterizedTypeBinding annotatedPTB = (ParameterizedTypeBinding) annotatedType;
+ if (unannotatedPTB.arguments != null
+ && annotatedPTB.arguments != null
+ && unannotatedPTB.arguments.length == annotatedPTB.arguments.length) {
+ int length = annotatedPTB.arguments.length;
+ newArguments = new TypeBinding[length];
+ for (int i = 0; i < length; i++) {
+ newArguments[i] = copyAnnotations(annotatedPTB.arguments[i], unannotatedPTB.arguments[i]);
+ }
+ }
+ }
+ ReferenceBinding annotatedEnclosing = annotatedType.enclosingType();
+ ReferenceBinding newEnclosing = unannotatedSubstitute.enclosingType();
+ if (annotatedEnclosing != null && annotatedEnclosing.hasNullTypeAnnotations())
+ newEnclosing = (ReferenceBinding) copyAnnotations(annotatedEnclosing, newEnclosing);
+ long nullTagBits = annotatedType.tagBits & TagBits.AnnotationNullMASK;
+ return createParameterizedType((ReferenceBinding)unannotatedSubstitute.original(), newArguments, nullTagBits, newEnclosing);
+
+ } else if (annotatedType instanceof ArrayBinding && unannotatedSubstitute instanceof ArrayBinding) {
+ long[] tagBitsOnDimensions = ((ArrayBinding) annotatedType).nullTagBitsPerDimension;
+ TypeBinding annotatedLeaf = annotatedType.leafComponentType();
+ TypeBinding newLeafType = unannotatedSubstitute.leafComponentType();
+ if (annotatedLeaf.hasNullTypeAnnotations())
+ newLeafType = copyAnnotations(annotatedLeaf, newLeafType);
+ return createArrayType(newLeafType, unannotatedSubstitute.dimensions(), tagBitsOnDimensions);
+ }
+ return unannotatedSubstitute; // shouldn't happen actually
}
/**
@@ -1415,6 +1424,9 @@
}
public WildcardBinding createWildcard(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind) {
+ return createWildcard(genericType, rank, bound, otherBounds, boundKind, 0);
+}
+public WildcardBinding createWildcard(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind, long annotationTagBits) {
// cached info is array of already created wildcard types for this type
if (genericType == null) // pseudo wildcard denoting composite bounds for lub computation
genericType = ReferenceBinding.LUB_GENERIC;
@@ -1429,6 +1441,7 @@
if (cachedType == null) break nextCachedType;
if (cachedType.genericType != genericType) continue nextCachedType; // remain of unresolved type
if (cachedType.rank != rank) continue nextCachedType;
+ if ((cachedType.tagBits & TagBits.AnnotationNullMASK) != annotationTagBits) continue nextCachedType;
if (cachedType.boundKind != boundKind) continue nextCachedType;
if (cachedType.bound != bound) continue nextCachedType;
if (cachedType.otherBounds != otherBounds) {
@@ -1455,6 +1468,8 @@
}
// add new binding
WildcardBinding wildcard = new WildcardBinding(genericType, rank, bound, otherBounds, boundKind, this);
+ if (annotationTagBits != 0)
+ wildcard.tagBits |= annotationTagBits | TagBits.HasNullTypeAnnotation;
cachedInfo[index] = wildcard;
return wildcard;
}
@@ -1964,17 +1979,20 @@
case '-' :
// ? super aType
wrapper.start++;
- TypeBinding bound = getTypeFromTypeSignature(wrapper, staticVariables, enclosingType, missingTypeNames, walker);
- return createWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.SUPER);
+ TypeBinding bound = getTypeFromTypeSignature(wrapper, staticVariables, enclosingType, missingTypeNames, walker.toWildcardBound());
+ long tagBits = typeAnnotationsToTagBits(walker.getAnnotationsAtCursor());
+ return createWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.SUPER, tagBits);
case '+' :
// ? extends aType
wrapper.start++;
- bound = getTypeFromTypeSignature(wrapper, staticVariables, enclosingType, missingTypeNames, walker);
- return createWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.EXTENDS);
+ bound = getTypeFromTypeSignature(wrapper, staticVariables, enclosingType, missingTypeNames, walker.toWildcardBound());
+ tagBits = typeAnnotationsToTagBits(walker.getAnnotationsAtCursor());
+ return createWildcard(genericType, rank, bound, null /*no extra bound*/, Wildcard.EXTENDS, tagBits);
case '*' :
// ?
wrapper.start++;
- return createWildcard(genericType, rank, null, null /*no extra bound*/, Wildcard.UNBOUND);
+ tagBits = typeAnnotationsToTagBits(walker.getAnnotationsAtCursor());
+ return createWildcard(genericType, rank, null, null /*no extra bound*/, Wildcard.UNBOUND, tagBits);
default :
return getTypeFromTypeSignature(wrapper, staticVariables, enclosingType, missingTypeNames, walker);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
index 0584e8d..faf7c59 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java
@@ -21,6 +21,8 @@
* bug 365531 - [compiler][null] investigate alternative strategy for internally encoding nullness defaults
* bug 388281 - [compiler][null] inheritance of null annotations as an option
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
+ * Jesper Steen Moller - Contributions for
+ * Bug 412150 [1.8] [compiler] Enable reflected parameter names during annotation processing
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -233,6 +235,9 @@
/** Store nullness information from annotation (incl. applicable default). */
public Boolean[] parameterNonNullness; // TRUE means @NonNull declared, FALSE means @Nullable declared, null means nothing declared
+ /** Store parameter names from MethodParameters attribute (incl. applicable default). */
+ public char[][] parameterNames = Binding.NO_PARAMETER_NAMES;
+
protected MethodBinding() {
// for creating problem or synthetic method
}
@@ -339,7 +344,7 @@
return false;
for (int i = 0; i < length; i++)
- if (this.parameters[i] != args[i])
+ if (this.parameters[i].unannotated() != args[i].unannotated())
return false;
return true;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
index de77c74..3224ea3 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java
@@ -18,7 +18,8 @@
* bug 374605 - Unreasonable warning for enum-based switch statements
* bug 382353 - [1.8][compiler] Implementation property modifiers should be accepted on default methods.
* bug 382354 - [1.8][compiler] Compiler silent on conflicting modifier
- * bug 401030 - [1.8][null] Null analysis support for lambda methods.
+ * bug 401030 - [1.8][null] Null analysis support for lambda methods.
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
* Jesper S Moller - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
*******************************************************************************/
@@ -657,6 +658,10 @@
return scope == null ? null : scope.referenceContext;
}
+void resolveTypeParameter(TypeParameter typeParameter) {
+ typeParameter.resolve(this);
+}
+
//{ObjectTeams: new queries:
/**
* Does this scope represent a callin wrapper
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
index ff17bd9..e5ff6f2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java
@@ -16,7 +16,6 @@
package org.eclipse.jdt.internal.compiler.lookup;
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
-import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.objectteams.otdt.internal.core.compiler.lookup.AnchorMapping;
import org.eclipse.objectteams.otdt.internal.core.compiler.lookup.DependentTypeBinding;
@@ -398,17 +397,6 @@
this.parameterNonNullness = originalMethod.parameterNonNullness;
}
- public void checkNullConstraints(Scope scope, TypeReference typeArgument, int rank) {
- TypeBinding[] variables = this.originalMethod.typeVariables();
- if (variables != null && variables.length > rank) {
- if (variables[rank].hasNullTypeAnnotations()) {
- if ((typeArgument.resolvedType.tagBits & TagBits.AnnotationNullMASK) != (variables[rank].tagBits & TagBits.AnnotationNullMASK)) {
- scope.problemReporter().nullityMismatchTypeArgument(variables[rank], typeArgument.resolvedType, typeArgument);
- }
- }
- }
- }
-
/*
* parameterizedDeclaringUniqueKey dot selector originalMethodGenericSignature percent typeArguments
* p.X<U> { <T> void bar(T t, U u) { new X<String>().bar(this, "") } } --> Lp/X<Ljava/lang/String;>;.bar<T:Ljava/lang/Object;>(TT;Ljava/lang/String;)V%<Lp/X;>
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 f7d3821..c4d9637 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
@@ -22,6 +22,12 @@
* Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
* Bug 412076 - [compiler] @NonNullByDefault doesn't work for varargs parameter when in generic interface
+ * Bug 403216 - [1.8][null] TypeReference#captureTypeAnnotations treats type annotations as type argument annotations
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 416175 - [1.8][compiler][null] NPE with a code snippet that used null annotations on wildcards
+ * Bug 416174 - [1.8][compiler][null] Bogus name clash error with null annotations
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -375,7 +381,7 @@
*/
public String debugName() {
StringBuffer nameBuffer = new StringBuffer(10);
- appendNullAnnotation(nameBuffer);
+ appendNullAnnotation(nameBuffer, this.environment.globalOptions);
if (this.type instanceof UnresolvedReferenceBinding) {
nameBuffer.append(this.type);
} else {
@@ -460,6 +466,9 @@
*/
public char[] genericTypeSignature() {
if (this.genericTypeSignature == null) {
+ if (isAnnotatedTypeWithoutArguments())
+ return this.genericTypeSignature = this.type.genericTypeSignature();
+
if ((this.modifiers & ExtraCompilerModifiers.AccGenericSignature) == 0) {
this.genericTypeSignature = this.type.signature();
} else {
@@ -810,6 +819,13 @@
// SH}
public boolean isEquivalentTo(TypeBinding otherType) {
+ // disregard any type annotations on this and otherType
+ // recursive call needed when this is annotated, unless the annotation was introduced on a declaration
+ otherType = otherType.unannotated();
+ TypeBinding unannotated = unannotated();
+ if (unannotated != this)
+ return unannotated.isEquivalentTo(otherType);
+
if (this == otherType)
return true;
if (otherType == null)
@@ -878,9 +894,9 @@
}
public boolean isAnnotatedTypeWithoutArguments() {
- if (this.arguments != null)
+ if (this.arguments != null || !hasNullTypeAnnotations())
return false;
- if (this.enclosingType != null)
+ if (this.enclosingType != null && this.enclosingType instanceof ParameterizedTypeBinding)
return this.enclosingType.isAnnotatedTypeWithoutArguments();
return true;
}
@@ -897,7 +913,7 @@
unannotatedArguments[i] = this.arguments[i].unannotated();
}
}
- return this.environment.createParameterizedType(this.type, unannotatedArguments,
+ return this.environment.createParameterizedType((ReferenceBinding) this.type.unannotated(), unannotatedArguments,
this.enclosingType == null ? null : (ReferenceBinding) this.enclosingType.unannotated());
}
@@ -1161,7 +1177,7 @@
if (isMemberType()) {
nameBuffer.append(enclosingType().nullAnnotatedReadableName(options, false));
nameBuffer.append('.');
- appendNullAnnotation(nameBuffer);
+ appendNullAnnotation(nameBuffer, options);
nameBuffer.append(this.sourceName);
} else if (this.type.compoundName != null) {
int i;
@@ -1170,12 +1186,15 @@
nameBuffer.append(this.type.compoundName[i]);
nameBuffer.append('.');
}
- appendNullAnnotation(nameBuffer);
+ appendNullAnnotation(nameBuffer, options);
nameBuffer.append(this.type.compoundName[i]);
} else {
// case of TypeVariableBinding with nullAnnotationTagBits:
- appendNullAnnotation(nameBuffer);
- nameBuffer.append(this.type.sourceName);
+ appendNullAnnotation(nameBuffer, options);
+ if (this.type.sourceName != null)
+ nameBuffer.append(this.type.sourceName);
+ else // WildcardBinding, CaptureBinding have no sourceName
+ nameBuffer.append(this.type.readableName());
}
if (this.arguments != null && this.arguments.length > 0) { // empty arguments array happens when PTB has been created just to capture type annotations
nameBuffer.append('<');
@@ -1196,11 +1215,14 @@
if (isMemberType()) {
nameBuffer.append(enclosingType().nullAnnotatedReadableName(options, true));
nameBuffer.append('.');
- appendNullAnnotation(nameBuffer);
+ appendNullAnnotation(nameBuffer, options);
nameBuffer.append(this.sourceName);
} else {
- appendNullAnnotation(nameBuffer);
- nameBuffer.append(this.type.sourceName);
+ appendNullAnnotation(nameBuffer, options);
+ if (this.type.sourceName != null)
+ nameBuffer.append(this.type.sourceName);
+ else // WildcardBinding, CaptureBinding have no sourceName
+ nameBuffer.append(this.type.shortReadableName());
}
if (this.arguments != null && this.arguments.length > 0) { // empty arguments array happens when PTB has been created just to capture type annotations
nameBuffer.append('<');
@@ -1216,18 +1238,6 @@
return shortReadableName;
}
- private void appendNullAnnotation(StringBuffer nameBuffer) {
- if (this.environment.globalOptions.isAnnotationBasedNullAnalysisEnabled) {
- // restore applied null annotation from tagBits:
- if ((this.tagBits & TagBits.AnnotationNonNull) != 0) {
- char[][] nonNullAnnotationName = environment().getNonNullAnnotationName();
- nameBuffer.append('@').append(nonNullAnnotationName[nonNullAnnotationName.length-1]).append(' ');
- } else if ((this.tagBits & TagBits.AnnotationNullable) != 0) {
- char[][] nullableAnnotationName = environment().getNullableAnnotationName();
- nameBuffer.append('@').append(nullableAnnotationName[nullableAnnotationName.length-1]).append(' ');
- }
- }
- }
/**
* @see org.eclipse.jdt.internal.compiler.lookup.TypeBinding#signature()
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
index b2d4cf0..54b3b17 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java
@@ -13,6 +13,8 @@
* IBM Corporation - initial API and implementation
* Stephan Herrmann - Contribution for
* bug 392384 - [1.8][compiler][null] Restore nullness info from type annotations in class files
+ * Bug 416174 - [1.8][compiler][null] Bogus name clash error with null annotations
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -136,6 +138,13 @@
}
public boolean isEquivalentTo(TypeBinding otherType) {
+ // disregard any type annotations on this and otherType
+ // recursive call needed when this is annotated, unless the annotation was introduced on a declaration
+ otherType = otherType.unannotated();
+ TypeBinding unannotated = unannotated();
+ if (unannotated != this)
+ return unannotated.isEquivalentTo(otherType);
+
if (this == otherType || erasure() == otherType)
return true;
if (otherType == null)
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
index fd8797d..8f982bc 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java
@@ -28,6 +28,7 @@
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
* Jesper S Moller - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
*******************************************************************************/
@@ -40,6 +41,7 @@
import org.eclipse.jdt.core.compiler.InvalidInputException;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
import org.eclipse.objectteams.otdt.core.compiler.IOTConstants;
import org.eclipse.objectteams.otdt.core.exceptions.InternalCompilerError;
@@ -1518,9 +1520,13 @@
}
public boolean isCompatibleWith(TypeBinding otherType, boolean useObjectShortcut, /*@Nullable*/ Scope captureScope) {
// SH}
- otherType = otherType.unannotated(); // for now consider un-annotated type as compatible to type with any type annotations
- if ((this.tagBits & TagBits.HasNullTypeAnnotation) != 0)
- return unannotated().isCompatibleWith(otherType, captureScope);
+ // disregard any type annotations on this and otherType
+ // recursive call needed when this is annotated, unless the annotation was introduced on a declaration
+ otherType = otherType.unannotated();
+ TypeBinding unannotated = unannotated();
+ if (unannotated != this)
+ return unannotated.isCompatibleWith(otherType, captureScope);
+
if (otherType == this)
return true;
//{ObjectTeams: respect new argument useObjectShortcut:
@@ -1908,6 +1914,19 @@
return readableName;
}
+protected void appendNullAnnotation(StringBuffer nameBuffer, CompilerOptions options) {
+ if (options.isAnnotationBasedNullAnalysisEnabled) {
+ // restore applied null annotation from tagBits:
+ if ((this.tagBits & TagBits.AnnotationNonNull) != 0) {
+ char[][] nonNullAnnotationName = options.nonNullAnnotationName;
+ nameBuffer.append('@').append(nonNullAnnotationName[nonNullAnnotationName.length-1]).append(' ');
+ } else if ((this.tagBits & TagBits.AnnotationNullable) != 0) {
+ char[][] nullableAnnotationName = options.nullableAnnotationName;
+ nameBuffer.append('@').append(nullableAnnotationName[nullableAnnotationName.length-1]).append(' ');
+ }
+ }
+}
+
public AnnotationHolder retrieveAnnotationHolder(Binding binding, boolean forceInitialization) {
SimpleLookupTable store = storedAnnotations(forceInitialization);
return store == null ? null : (AnnotationHolder) store.get(binding);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
index 94d61b2..d2e757d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java
@@ -20,6 +20,11 @@
* bug 401456 - Code compiles from javac/intellij, but fails from eclipse
* bug 401271 - StackOverflowError when searching for a methods references
* bug 405706 - Eclipse compiler fails to give compiler error when return type is a inferred generic
+ * Bug 408441 - Type mismatch using Arrays.asList with 3 or more implementations of an interface with the interface type as the last parameter
+ * Bug 413958 - Function override returning inherited Generic Type
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416183 - [1.8][compiler][null] Overload resolution fails with null annotations
+ * Bug 416176 - [1.8][compiler][null] null type annotations cause grief on type variables
* Jesper S Moller - Contributions for
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
* Bug 378674 - "The method can be declared as static" is wrong
@@ -444,6 +449,16 @@
* of its type in the generic declaration corresponding to C."
*/
public static TypeBinding substitute(Substitution substitution, TypeBinding originalType) {
+ TypeBinding unannotatedOriginal = originalType.unannotated();
+ TypeBinding substitute = substitute0(substitution, unannotatedOriginal);
+ if (unannotatedOriginal == originalType) // no annotation => use naked substitute
+ return substitute;
+ else if (substitute == unannotatedOriginal) // no substitution => re-use annotated type
+ return originalType;
+ else // substitution and annotation: merge both
+ return substitution.environment().copyAnnotations(originalType, substitute);
+ }
+ private static TypeBinding substitute0(Substitution substitution, TypeBinding originalType) {
if (originalType == null) return null;
//{ObjectTeams: unwrap type variable from dependent type?
if (DependentTypeBinding.isDependentTypeVariable(originalType))
@@ -759,7 +774,8 @@
Map invocations = new HashMap(2);
boolean noProblems = true;
// preinitializing each type variable
- for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
+ int paramLength = typeParameters.length;
+ for (int i = 0; i < paramLength; i++) {
TypeParameter typeParameter = typeParameters[i];
//{ObjectTeams: don't expect a TypeVariableBinding for a TypeValueParameter:
if (typeParameter instanceof TypeValueParameter)
@@ -773,7 +789,7 @@
// set firstBound to the binding of the first explicit bound in parameter declaration
typeVariable.firstBound = null; // first bound used to compute erasure
}
- nextVariable: for (int i = 0, paramLength = typeParameters.length; i < paramLength; i++) {
+ nextVariable: for (int i = 0; i < paramLength; i++) {
TypeParameter typeParameter = typeParameters[i];
//{ObjectTeams: don't expect a TypeVariableBinding for a TypeValueParameter:
if (typeParameter instanceof TypeValueParameter)
@@ -923,6 +939,10 @@
}
noProblems &= (typeVariable.tagBits & TagBits.HierarchyHasProblems) == 0;
}
+ // after bounds have been resolved we're ready for resolving the type parameter itself,
+ // which includes resolving/evaluating type annotations and checking for inconsistencies
+ for (int i = 0; i < paramLength; i++)
+ resolveTypeParameter(typeParameters[i]);
return noProblems;
}
@@ -997,6 +1017,10 @@
return typeVariableBindings;
}
+ void resolveTypeParameter(TypeParameter typeParameter) {
+ // valid only for ClassScope and MethodScope
+ }
+
public final ClassScope enclosingClassScope() {
Scope scope = this;
while ((scope = scope.parent) != null) {
@@ -4949,14 +4973,28 @@
return visibleIndex == 1 ? visible[0] : mostSpecificMethodBinding(visible, visibleIndex, argumentTypes, allocationSite, allocationType);
}
- public void validateNullAnnotation(long tagBits, TypeReference typeRef, Annotation[] annotations) {
+ public boolean validateNullAnnotation(long tagBits, TypeReference typeRef, Annotation[] annotations) {
long nullAnnotationTagBit = tagBits & (TagBits.AnnotationNullMASK);
if (nullAnnotationTagBit != 0) {
TypeBinding type = typeRef.resolvedType;
if (type != null && type.isBaseType()) {
- problemReporter().illegalAnnotationForBaseType(typeRef, annotations, nullAnnotationTagBit);
+ // type annotations are *always* illegal for 'void' (already reported)
+ if (!(typeRef.resolvedType.id == TypeIds.T_void && compilerOptions().sourceLevel >= ClassFileConstants.JDK1_8))
+ problemReporter().illegalAnnotationForBaseType(typeRef, annotations, nullAnnotationTagBit);
+ return false;
+ }
+ if (annotations != null && typeRef instanceof QualifiedTypeReference) {
+ // illegal @NonNull Outer.Inner:
+ for (int i = 0; i < annotations.length; i++) {
+ int id = annotations[i].resolvedType.id;
+ if (id == TypeIds.T_ConfiguredAnnotationNonNull || id == TypeIds.T_ConfiguredAnnotationNullable) {
+ problemReporter().nullAnnotationUnsupportedLocation(annotations[i]);
+ return false;
+ }
+ }
}
}
+ return true;
}
public static BlockScope typeAnnotationsResolutionScope(Scope scope) {
BlockScope resolutionScope = null;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
index a41708e..e705969 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java
@@ -30,6 +30,9 @@
* bug 391376 - [1.8] check interaction of default methods with bridge methods and generics
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Bug 416172 - [1.8][compiler][null] null type annotation not evaluated on method return type
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -2101,12 +2104,13 @@
field.fillInDefaultNonNullness(fieldDecl, initializationScope);
}
// validate null annotation:
- this.scope.validateNullAnnotation(field.tagBits, fieldDecl.type, fieldDecl.annotations);
+ if (!this.scope.validateNullAnnotation(field.tagBits, fieldDecl.type, fieldDecl.annotations))
+ field.tagBits &= ~TagBits.AnnotationNullMASK;
}
if (sourceLevel >= ClassFileConstants.JDK1_8 && !fieldType.isBaseType()) {
long nullTagBits = field.tagBits & TagBits.AnnotationNullMASK;
if (nullTagBits != 0 && nullTagBits != (fieldType.tagBits & TagBits.AnnotationNullMASK))
- field.type = environment.pushAnnotationIntoType(fieldType, fieldDecl.type, nullTagBits);
+ field.type = environment.createAnnotatedType(fieldType, nullTagBits);
// do not reset field.tagBits, since more fields may need to share this information ("@NonNull Object o1, o2;")
}
}
@@ -2441,18 +2445,24 @@
// SH}
CompilerOptions compilerOptions = this.scope.compilerOptions();
if (compilerOptions.isAnnotationBasedNullAnalysisEnabled) {
- if (compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8) {
+ if (!method.isConstructor() && method.returnType != null) {
long nullTagBits = method.tagBits & TagBits.AnnotationNullMASK;
- if (nullTagBits != (method.returnType.tagBits & TagBits.AnnotationNullMASK)) {
+ if (nullTagBits != 0) {
TypeReference returnTypeRef = ((MethodDeclaration)methodDecl).returnType;
- if (method.returnType.isBaseType()) {
- if (method.returnType.id != TypeIds.T_void) // type annotations are *always* illegal for 'void'
- this.scope.problemReporter().illegalAnnotationForBaseType(returnTypeRef, methodDecl.annotations, nullTagBits);
+ if (compilerOptions.sourceLevel < ClassFileConstants.JDK1_8) {
+ if (!this.scope.validateNullAnnotation(nullTagBits, returnTypeRef, methodDecl.annotations))
+ method.tagBits &= ~TagBits.AnnotationNullMASK;
} else {
- // annotation was mistakenly associated to the method, create the annotated type now:
- method.returnType = this.scope.environment().pushAnnotationIntoType(method.returnType, returnTypeRef, nullTagBits);
+ if (nullTagBits != (method.returnType.tagBits & TagBits.AnnotationNullMASK)) {
+ if (!this.scope.validateNullAnnotation(nullTagBits, returnTypeRef, methodDecl.annotations)) {
+ method.returnType = method.returnType.unannotated();
+ } else {
+ // annotation was mistakenly associated to the method, create the annotated type now:
+ method.returnType = this.scope.environment().createAnnotatedType(method.returnType, nullTagBits);
+ }
+ method.tagBits &= ~TagBits.AnnotationNullMASK;
+ }
}
- method.tagBits &= ~TagBits.AnnotationNullMASK;
}
}
createArgumentBindings(method, compilerOptions); // need annotations resolved already at this point
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
index 92ef5c5..b9c2b36 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java
@@ -26,6 +26,8 @@
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
+import org.eclipse.jdt.internal.compiler.ast.TypeParameter;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.objectteams.otdt.internal.core.compiler.lookup.CallinCalloutBinding;
@@ -678,7 +680,8 @@
return this.superclass; // java/lang/Object
}
- public void evaluateNullAnnotations(Annotation[] annotations) {
+ public void evaluateNullAnnotations(Scope scope, TypeParameter parameter) {
+ Annotation[] annotations = parameter.annotations;
int len = annotations.length;
for (int j=0; j<len; j++) {
Binding recipient = annotations[j].recipient;
@@ -696,7 +699,11 @@
if (nullTagBits == 0L) {
nullTagBits |= superNullTagBits;
} else if (superNullTagBits != nullTagBits) {
-// System.err.println("TODO(stephan): report proper error: conflict TypeVariable vs. first bound");
+ // not finding either bound or ann should be considered a compiler bug
+ TypeReference bound = findBound(this.firstBound, parameter);
+ Annotation ann = bound.findAnnotation(superNullTagBits);
+ scope.problemReporter().contradictoryNullAnnotationsOnBounds(ann, nullTagBits);
+ this.tagBits &= ~TagBits.AnnotationNullMASK;
}
}
}
@@ -710,7 +717,11 @@
if (nullTagBits == 0L) {
nullTagBits |= superNullTagBits;
} else if (superNullTagBits != nullTagBits) {
-// System.err.println("TODO(stephan): report proper error: conflict TypeVariable vs. bound "+i);
+ // not finding either bound or ann should be considered a compiler bug
+ TypeReference bound = findBound(this.firstBound, parameter);
+ Annotation ann = bound.findAnnotation(superNullTagBits);
+ scope.problemReporter().contradictoryNullAnnotationsOnBounds(ann, nullTagBits);
+ this.tagBits &= ~TagBits.AnnotationNullMASK;
}
}
interfaces[i] = resolveType;
@@ -719,4 +730,16 @@
if (nullTagBits != 0)
this.tagBits |= nullTagBits | TagBits.HasNullTypeAnnotation;
}
+ private TypeReference findBound(TypeBinding bound, TypeParameter parameter) {
+ if (parameter.type != null && parameter.type.resolvedType == bound)
+ return parameter.type;
+ TypeReference[] bounds = parameter.bounds;
+ if (bounds != null) {
+ for (int i = 0; i < bounds.length; i++) {
+ if (bounds[i].resolvedType == bound)
+ return bounds[i];
+ }
+ }
+ return null;
+ }
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java
index 849b0ba..f8eca68 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java
@@ -25,6 +25,7 @@
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.objectteams.otdt.internal.core.compiler.util.RoleTypeCreator;
import org.eclipse.objectteams.otdt.internal.core.compiler.util.RoleTypeCreator.TypeArgumentUpdater;
@@ -489,12 +490,12 @@
this.fPackage = someGenericType.getPackage();
}
if (someBound != null) {
- this.tagBits |= someBound.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType | TagBits.ContainsNestedTypeReferences);
+ this.tagBits |= someBound.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType | TagBits.ContainsNestedTypeReferences | TagBits.HasNullTypeAnnotation);
}
if (someOtherBounds != null) {
for (int i = 0, max = someOtherBounds.length; i < max; i++) {
TypeBinding someOtherBound = someOtherBounds[i];
- this.tagBits |= someOtherBound.tagBits & TagBits.ContainsNestedTypeReferences;
+ this.tagBits |= someOtherBound.tagBits & (TagBits.ContainsNestedTypeReferences | TagBits.HasNullTypeAnnotation);
}
}
}
@@ -562,6 +563,32 @@
}
}
+ public char[] nullAnnotatedReadableName(CompilerOptions options, boolean shortNames) {
+ StringBuffer buffer = new StringBuffer(10);
+ appendNullAnnotation(buffer, options);
+ switch (this.boundKind) {
+ case Wildcard.UNBOUND :
+ buffer.append(TypeConstants.WILDCARD_NAME);
+ break;
+ case Wildcard.EXTENDS :
+ if (this.otherBounds == null) {
+ buffer.append(TypeConstants.WILDCARD_NAME).append(TypeConstants.WILDCARD_EXTENDS).append(this.bound.readableName());
+ } else {
+ buffer.append(this.bound.nullAnnotatedReadableName(options, shortNames));
+ for (int i = 0, length = this.otherBounds.length; i < length; i++) {
+ buffer.append('&').append(this.otherBounds[i].nullAnnotatedReadableName(options, shortNames));
+ }
+ }
+ break;
+ default: // SUPER
+ buffer.append(TypeConstants.WILDCARD_NAME).append(TypeConstants.WILDCARD_SUPER).append(this.bound.nullAnnotatedReadableName(options, shortNames));
+ }
+ int length;
+ char[] result = new char[length = buffer.length()];
+ buffer.getChars(0, length, result, 0);
+ return result;
+ }
+
ReferenceBinding resolve() {
if ((this.tagBits & TagBits.HasUnresolvedTypeVariables) == 0)
return this;
@@ -747,4 +774,17 @@
}
return this.typeVariable;
}
+
+ public TypeBinding unannotated() {
+ if (!hasNullTypeAnnotations())
+ return this;
+ TypeBinding boundType = this.bound.unannotated();
+ TypeBinding[] otherBoundTypes = null;
+ if (this.otherBounds != null) {
+ otherBoundTypes = new TypeBinding[this.otherBounds.length];
+ for (int i = 0; i < this.otherBounds.length; i++)
+ otherBoundTypes[i] = this.otherBounds[i].unannotated();
+ }
+ return this.environment.createWildcard(this.genericType, this.rank, boundType, otherBoundTypes, this.boundKind);
+ }
}
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 3c3552a..52c73a3 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
@@ -28,6 +28,7 @@
* bug 393192 - Incomplete type hierarchy with > 10 annotations
* Andy Clement - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.parser;
@@ -4336,7 +4337,6 @@
declaration.annotations = new Annotation[length],
0,
length);
- declaration.bits |= ASTNode.HasTypeAnnotations;
}
type = getTypeReference(typeDim = this.intStack[this.intPtr--]); // type dimension
if (declaration.declarationSourceStart == -1) {
@@ -4358,7 +4358,6 @@
declaration.annotations = new Annotation[length],
0,
length);
- declaration.bits |= ASTNode.HasTypeAnnotations;
}
// Store javadoc only on first declaration as it is the same for all ones
FieldDeclaration fieldDeclaration = (FieldDeclaration) declaration;
@@ -4376,7 +4375,6 @@
if (annotations != null) {
final int annotationsLength = annotations.length;
System.arraycopy(annotations, 0, declaration.annotations = new Annotation[annotationsLength], 0, annotationsLength);
- declaration.bits |= ASTNode.HasTypeAnnotations;
}
}
@@ -4389,7 +4387,7 @@
Annotation[][] annotationsOnDimensions = type.getAnnotationsOnDimensions();
if (annotationsOnDimensions != null || annotationsOnExtendedDimensions != null) {
annotationsOnAllDimensions = getMergedAnnotationsOnDimensions(typeDim, annotationsOnDimensions, extendedDimension, annotationsOnExtendedDimensions);
- declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
+// declaration.bits |= (type.bits & ASTNode.HasTypeAnnotations);
}
declaration.type = copyDims(type, dimension, annotationsOnAllDimensions);
}
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 c979aae..608845b 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
@@ -43,6 +43,10 @@
* Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
* Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
* Bug 415291 - [1.8][null] differentiate type incompatibilities due to null annotations
+ * Bug 415850 - [1.8] Ensure RunJDTCoreTests can cope with null annotations enabled
+ * Bug 414380 - [compiler][internal] QualifiedNameReference#indexOfFirstFieldBinding does not point to the first field
+ * Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+ * Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
* Jesper S Moller <jesper@selskabet.org> - Contributions for
* bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
* bug 382721 - [1.8][compiler] Effectively final variables needs special treatment
@@ -109,6 +113,7 @@
import org.eclipse.jdt.internal.compiler.ast.MessageSend;
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.NameReference;
+import org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching;
import org.eclipse.jdt.internal.compiler.ast.NullLiteral;
import org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
import org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
@@ -431,6 +436,7 @@
case IProblem.ConflictingNullAnnotations:
case IProblem.ConflictingInheritedNullAnnotations:
case IProblem.NullityMismatchingTypeAnnotation:
+ case IProblem.NullityMismatchingTypeAnnotationSuperHint:
case IProblem.NullityMismatchTypeArgument:
case IProblem.UninitializedNonNullField:
case IProblem.UninitializedNonNullFieldHintMissingDefault:
@@ -445,8 +451,10 @@
return CompilerOptions.NullAnnotationInferenceConflict;
case IProblem.RequiredNonNullButProvidedUnknown:
case IProblem.NullityUncheckedTypeAnnotationDetail:
+ case IProblem.NullityUncheckedTypeAnnotationDetailSuperHint:
case IProblem.ReferenceExpressionParameterRequiredNonnullUnchecked:
case IProblem.ReferenceExpressionReturnNullRedefUnchecked:
+ case IProblem.UnsafeNullnessCast:
return CompilerOptions.NullUncheckedConversion;
case IProblem.RedundantNullAnnotation:
case IProblem.RedundantNullDefaultAnnotation:
@@ -6213,6 +6221,26 @@
handle(IProblem.NullAnnotationUnsupportedLocation,
arguments, shortArguments, annotation.sourceStart, annotation.sourceEnd);
}
+public void nullAnnotationUnsupportedLocation(TypeReference type) {
+ int sourceEnd = type.sourceEnd;
+ if (type instanceof ParameterizedSingleTypeReference) {
+ ParameterizedSingleTypeReference typeReference = (ParameterizedSingleTypeReference) type;
+ TypeReference[] typeArguments = typeReference.typeArguments;
+ if (typeArguments[typeArguments.length - 1].sourceEnd > typeReference.sourceEnd) {
+ sourceEnd = retrieveClosingAngleBracketPosition(typeReference.sourceEnd);
+ } else {
+ sourceEnd = type.sourceEnd;
+ }
+ } else if (type instanceof ParameterizedQualifiedTypeReference) {
+ ParameterizedQualifiedTypeReference typeReference = (ParameterizedQualifiedTypeReference) type;
+ sourceEnd = retrieveClosingAngleBracketPosition(typeReference.sourceEnd);
+ } else {
+ sourceEnd = type.sourceEnd;
+ }
+
+ handle(IProblem.NullAnnotationUnsupportedLocationAtType,
+ NoArgument, NoArgument, type.sourceStart, sourceEnd);
+}
public void localVariableNullInstanceof(LocalVariableBinding local, ASTNode location) {
int severity = computeSeverity(IProblem.NullLocalVariableInstanceofYieldsFalse);
if (severity == ProblemSeverities.Ignore) return;
@@ -6289,16 +6317,15 @@
String[] argumentsShort = new String[] { String.valueOf(boxType.shortReadableName()) };
this.handle(IProblem.NullUnboxing, arguments, argumentsShort, expression.sourceStart, expression.sourceEnd);
}
-public void nullableFieldDereference(VariableBinding variable, long position) {
- String[] arguments = new String[] {new String(variable.name)};
+public void nullableFieldDereference(FieldBinding variable, long position) {
char[][] nullableName = this.options.nullableAnnotationName;
- arguments = new String[] {new String(variable.name), new String(nullableName[nullableName.length-1])};
+ String[] arguments = new String[] {new String(variable.name), new String(nullableName[nullableName.length-1])};
this.handle(
IProblem.NullableFieldReference,
arguments,
arguments,
(int)(position >>> 32),
- (int)(position));
+ (int)position);
}
public void localVariableRedundantCheckOnNonNull(LocalVariableBinding local, ASTNode location) {
@@ -8763,6 +8790,22 @@
castExpression.sourceStart,
castExpression.sourceEnd);
}
+public void unsafeNullnessCast(CastExpression castExpression, Scope scope) {
+ TypeBinding castedExpressionType = castExpression.expression.resolvedType;
+ TypeBinding castExpressionResolvedType = castExpression.resolvedType;
+ this.handle(
+ IProblem.UnsafeNullnessCast,
+ new String[]{
+ new String(castedExpressionType.nullAnnotatedReadableName(this.options, false)),
+ new String(castExpressionResolvedType.nullAnnotatedReadableName(this.options, false))
+ },
+ new String[]{
+ new String(castedExpressionType.nullAnnotatedReadableName(this.options, true)),
+ new String(castExpressionResolvedType.nullAnnotatedReadableName(this.options, true))
+ },
+ castExpression.sourceStart,
+ castExpression.sourceEnd);
+}
public void unsafeGenericArrayForVarargs(TypeBinding leafComponentType, ASTNode location) {
int severity = computeSeverity(IProblem.UnsafeGenericArrayForVarargs);
if (severity == ProblemSeverities.Ignore) return;
@@ -9615,7 +9658,7 @@
if (this.options.sourceLevel < ClassFileConstants.JDK1_8)
nullityMismatchIsUnknown(expression, providedType, requiredType, annotationName);
else
- nullityMismatchingTypeAnnotation(expression, providedType, requiredType, 1/*unchecked*/);
+ nullityMismatchingTypeAnnotation(expression, providedType, requiredType, NullAnnotationMatching.NULL_ANNOTATIONS_UNCHECKED);
}
public void nullityMismatchIsNull(Expression expression, TypeBinding requiredType) {
int problemId = IProblem.RequiredNonNullButProvidedNull;
@@ -13343,7 +13386,7 @@
sourceStart,
methodDecl.returnType.sourceEnd);
}
-public void parameterLackingNullableAnnotation(ReferenceExpression location, MethodBinding descriptorMethod, int idx,
+public void parameterLackingNullableAnnotation(ReferenceExpression location, MethodBinding descriptorMethod, int idx, int paramOffset,
char[][] providedAnnotationName, char/*@Nullable*/[][] requiredAnnotationName, TypeBinding requiredType) {
StringBuffer requiredPrefix = new StringBuffer();
StringBuffer requiredShortPrefix = new StringBuffer();
@@ -13351,7 +13394,7 @@
requiredPrefix.append('@').append(CharOperation.toString(requiredAnnotationName)).append(' ');
requiredShortPrefix.append('@').append(requiredAnnotationName[requiredAnnotationName.length-1]).append(' ');
}
- TypeBinding provided = descriptorMethod.parameters[idx];
+ TypeBinding provided = descriptorMethod.parameters[idx+paramOffset];
StringBuffer methodSignature = new StringBuffer();
methodSignature
.append(descriptorMethod.declaringClass.readableName())
@@ -13546,6 +13589,17 @@
this.handle(IProblem.ContradictoryNullAnnotations, arguments, shortArguments, annotation.sourceStart, annotation.sourceEnd);
}
+public void contradictoryNullAnnotationsOnBounds(Annotation annotation, long previousTagBit) {
+ char[][] annotationName = previousTagBit == TagBits.AnnotationNonNull ? this.options.nonNullAnnotationName : this.options.nullableAnnotationName;
+ String[] arguments = {
+ new String(CharOperation.concatWith(annotationName, '.')),
+ };
+ String[] shortArguments = {
+ new String(annotationName[annotationName.length-1]),
+ };
+ this.handle(IProblem.ContradictoryNullAnnotationsOnBound, arguments, shortArguments, annotation.sourceStart, annotation.sourceEnd);
+}
+
//conflict default <-> inherited
public void conflictingNullAnnotations(MethodBinding currentMethod, ASTNode location, MethodBinding inheritedMethod)
{
@@ -13721,24 +13775,34 @@
this.handle(IProblem.ArrayReferencePotentialNullReference, NoArgument, NoArgument, arrayReference.sourceStart, arrayReference.sourceEnd);
}
-public void nullityMismatchingTypeAnnotation(Expression expression, TypeBinding providedType, TypeBinding requiredType, int severity)
+public void nullityMismatchingTypeAnnotation(Expression expression, TypeBinding providedType, TypeBinding requiredType, NullAnnotationMatching status)
{
if (providedType.id == TypeIds.T_null) {
nullityMismatchIsNull(expression, requiredType);
return;
}
- String[] arguments = new String[] {
- String.valueOf(requiredType.nullAnnotatedReadableName(this.options, false)),
- String.valueOf(providedType.nullAnnotatedReadableName(this.options, false))
- };
- String[] shortArguments = new String[] {
- String.valueOf(requiredType.nullAnnotatedReadableName(this.options, true)),
- String.valueOf(providedType.nullAnnotatedReadableName(this.options, true))
- };
- int problemId = severity == 1 ? IProblem.NullityUncheckedTypeAnnotationDetail : IProblem.NullityMismatchingTypeAnnotation;
- this.handle(
- problemId,
- arguments, shortArguments, expression.sourceStart, expression.sourceEnd);
+ String[] arguments ;
+ String[] shortArguments;
+
+ int problemId = 0;
+ if (status.superTypeHint != null) {
+ problemId = (status.isUnchecked()
+ ? IProblem.NullityUncheckedTypeAnnotationDetailSuperHint
+ : IProblem.NullityMismatchingTypeAnnotationSuperHint);
+ arguments = new String[] { null, null, status.superTypeHintName(this.options, false) };
+ shortArguments = new String[] { null, null, status.superTypeHintName(this.options, true) };
+ } else {
+ problemId = (status.isUnchecked()
+ ? IProblem.NullityUncheckedTypeAnnotationDetail
+ : IProblem.NullityMismatchingTypeAnnotation);
+ arguments = new String[2];
+ shortArguments = new String[2];
+ }
+ arguments[0] = String.valueOf(requiredType.nullAnnotatedReadableName(this.options, false));
+ arguments[1] = String.valueOf(providedType.nullAnnotatedReadableName(this.options, false));
+ shortArguments[0] = String.valueOf(requiredType.nullAnnotatedReadableName(this.options, true));
+ shortArguments[1] = String.valueOf(providedType.nullAnnotatedReadableName(this.options, true));
+ this.handle(problemId, arguments, shortArguments, expression.sourceStart, expression.sourceEnd);
}
public void nullityMismatchTypeArgument(TypeBinding typeVariable, TypeBinding typeArgument, ASTNode location) {
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 89fe6c0..c297bb9 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
@@ -36,6 +36,8 @@
# bug 404649 - [1.8][compiler] detect illegal reference to indirect or redundant super
# Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis
# Bug 415043 - [1.8][null] Follow-up re null type annotations after bug 392099
+# Bug 392238 - [1.8][compiler][null] Detect semantically invalid null type annotations
+# Bug 416307 - [1.8][compiler][null] subclass with type parameter substitution confuses null checking
# Jesper S Moller <jesper@selskabet.org> - Contributions for
# bug 382701 - [1.8][compiler] Implement semantic analysis of Lambda expressions & Reference expression
# bug 384567 - [1.5][compiler] Compiler accepts illegal modifiers on package declaration
@@ -112,8 +114,8 @@
94 = The parameter {0} is hiding another local variable defined in an enclosing scope
95 = The parameter {0} is hiding a field from type {1}
96 = The serializable class {0} does not declare a static final serialVersionUID field of type long
-97 = Lambda expression's parameter {0} cannot redeclare another local variable defined in an enclosing scope.
-98 = Lambda expression's local variable {0} cannot redeclare another local variable defined in an enclosing scope.
+97 = Lambda expression''s parameter {0} cannot redeclare another local variable defined in an enclosing scope.
+98 = Lambda expression''s local variable {0} cannot redeclare another local variable defined in an enclosing scope.
99 = The type {0} from the descriptor computed for the target context is not visible here.
100 = The method {1}({2}) is undefined for the type {0}
101 = The method {1}({2}) from the type {0} is not visible
@@ -143,7 +145,7 @@
125 = Incompatible parameter list for array constructor. Expected (int), but found ({1})
126 = Constructed array {0} cannot be assigned to {1} as required in the interface descriptor
127 = The type {0} does not define {1}({2}) that is applicable here
-128 = The type of {0}({1}) from the type {2} is {3}, this is incompatible with the descriptor's return type: {4}
+128 = The type of {0}({1}) from the type {2} is {3}, this is incompatible with the descriptor''s return type: {4}
129 = The constructor {0}({1}) refers to the missing type {2}
130 = The constructor {0}({1}) is undefined
131 = The constructor {0}({1}) is not visible
@@ -616,12 +618,12 @@
635 = Unnecessary @SuppressWarnings("{0}")
636 = The method {0}({1}) of type {2} should be tagged with @Override since it actually overrides a superinterface method
637 = Syntax error, type annotations are available only when source level is at least 1.8
-638 = Explicit ''this'' parameter is allowed only in instance methods of non-anonymous classes and inner class constructors
+638 = Explicit 'this' parameter is allowed only in instance methods of non-anonymous classes and inner class constructors
639 = Syntax error, type annotations are illegal here
640 = Type annotations are not allowed on type names used to access static members
641 = Type annotation is illegal for a method that returns void
-642 = Only the first formal parameter may be declared explicitly as ''this''
-643 = Explicit declaration of ''this'' parameter is allowed only at source level 1.8 or above
+642 = Only the first formal parameter may be declared explicitly as 'this'
+643 = Explicit declaration of 'this' parameter is allowed only at source level 1.8 or above
644 = Default methods are allowed only at source level 1.8 or above
645 = Lambda expressions are allowed only at source level 1.8 or above
646 = Method references are allowed only at source level 1.8 or above
@@ -630,13 +632,13 @@
649 = Annotation types that do not specify explicit target element types cannot be applied here
650 = The declared type of the explicit ''this'' parameter is expected to be {0}
651 = The explicit ''this'' parameter is expected to be qualified with {0}
-652 = The explicit ''this'' parameter for a method cannot have a qualifying name
+652 = The explicit 'this' parameter for a method cannot have a qualifying name
653 = The target type of this expression must be a functional interface
654 = The variable argument type {0} of the lambda expression must be the last parameter
655 = The target type of this expression is not a well formed parameterized type due to bound(s) mismatch
656 = Lambda expression's signature does not match the signature of the functional interface method
-657 = Lambda expression's parameter {0} is expected to be of type {1}
-658 = Incompatible type specified for lambda expression's parameter {0}
+657 = Lambda expression''s parameter {0} is expected to be of type {1}
+658 = Incompatible type specified for lambda expression''s parameter {0}
659 = Illegal lambda expression: Method {0} of type {1} is generic
### MORE GENERICS
660 = Unused type arguments for the non generic constructor {0}({1}) of type {2}; it should not be parameterized with arguments <{3}>
@@ -645,8 +647,8 @@
### MORE TYPE RELATED
662 = Illegal attempt to create arrays of union types
663 = Variable {0} is required to be final or effectively final
-664 = Invalid '@FunctionalInterface' annotation; {0} is not a functional interface
-665 = The constructed object of type {0} is incompatible with the descriptor's return type: {1}
+664 = Invalid ''@FunctionalInterface'' annotation; {0} is not a functional interface
+665 = The constructed object of type {0} is incompatible with the descriptor''s return type: {1}
### NULL ANALYSIS FOR OTHER EXPRESSIONS
670 = Null comparison always yields false: this expression cannot be null
@@ -781,14 +783,19 @@
951 = Potential null pointer access: array element may be null
952 = Potential null pointer access: this expression has a ''@{0}'' type
953 = Null type mismatch (type annotations): required ''{0}'' but this expression has type ''{1}''
-954 = Null type safety (type annotations): The expression of type ''{1}'' needs unchecked conversion to conform to ''{0}''
-955 = Null type mismatch at parameter {0}: required ''{1}{2}'' but provided ''@{3} {4}'' via method descriptor {5}
-956 = Null type safety: parameter {0} provided via method descriptor {1} needs unchecked conversion to conform to ''@{2} {3}''
-957 = Null type mismatch at method return type: Method descriptor {0} promises ''@{1} {2}'' but referenced method provides ''{3}{4}''
-958 = Null type safety at method return type: Method descriptor {0} promises ''@{1} {2}'' but referenced method provides ''{3}{4}''
-959 = Redundant null check: comparing ''{0}'' against null
-960 = The nullness annotation ''{0}'' is not applicable at this location
-961 = Null constraint mismatch: The type ''{2}'' is not a valid substitute for the type parameter ''{0}'' which is constrained as ''@{1}''
+954 = Null type mismatch (type annotations): required ''{0}'' but this expression has type ''{1}'', corresponding supertype is ''{2}''
+955 = Null type safety (type annotations): The expression of type ''{1}'' needs unchecked conversion to conform to ''{0}''
+956 = Null type safety (type annotations): The expression of type ''{1}'' needs unchecked conversion to conform to ''{0}'', corresponding supertype is ''{2}''
+957 = Null type mismatch at parameter {0}: required ''{1}{2}'' but provided ''@{3} {4}'' via method descriptor {5}
+958 = Null type safety: parameter {0} provided via method descriptor {1} needs unchecked conversion to conform to ''@{2} {3}''
+959 = Null type mismatch at method return type: Method descriptor {0} promises ''@{1} {2}'' but referenced method provides ''{3}{4}''
+960 = Null type safety at method return type: Method descriptor {0} promises ''@{1} {2}'' but referenced method provides ''{3}{4}''
+961 = Redundant null check: comparing ''{0}'' against null
+962 = The nullness annotation ''{0}'' is not applicable at this location
+963 = Nullness annotations are not applicable at this location
+964 = Null constraint mismatch: The type ''{2}'' is not a valid substitute for the type parameter ''{0}'' which is constrained as ''@{1}''
+965 = This nullness annotation conflicts with a ''@{0}'' annotation which is effective on the same type parameter
+966 = Null type safety: Unchecked cast from {0} to {1}
# Java 8
1001 = Syntax error, modifiers and annotations are not allowed for the lambda parameter {0} as its type is elided
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 cdb7971..276a9b7 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
@@ -176,7 +176,7 @@
/**
* Internal synonym for {@link #JLS4}. Use to alleviate
* deprecation warnings.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
/*package*/ static final int JLS4_INTERNAL = JLS4;
@@ -192,7 +192,7 @@
* up to and including Java SE 8 (aka JDK 1.8).
* </p>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int JLS8 = 8;
@@ -1446,7 +1446,7 @@
*
* @return a new unparented creation reference expression node
* @exception UnsupportedOperationException if this operation is used in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public CreationReference newCreationReference() {
CreationReference result = new CreationReference(this);
@@ -1527,7 +1527,7 @@
*
* @return a new unparented expression method reference expression node
* @exception UnsupportedOperationException if this operation is used in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public ExpressionMethodReference newExpressionMethodReference() {
ExpressionMethodReference result = new ExpressionMethodReference(this);
@@ -1571,7 +1571,7 @@
* </ul>
* @exception UnsupportedOperationException if this operation is used
* in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public ExtraDimension newExtraDimension() {
ExtraDimension result = new ExtraDimension(this);
@@ -1790,7 +1790,7 @@
*
* @return a new unparented lambda expression node
* @exception UnsupportedOperationException if this operation is used in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public LambdaExpression newLambdaExpression() {
LambdaExpression result = new LambdaExpression(this);
@@ -2203,7 +2203,7 @@
* </ul>
* @exception UnsupportedOperationException if this operation is used in
* a JLS2, JLS3 and JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public PackageQualifiedType newPackageQualifiedType(Name qualifier, SimpleName name) {
PackageQualifiedType result = new PackageQualifiedType(this);
@@ -2468,7 +2468,7 @@
* and there is no qualifier and no type arguments.
*
* @return a new unparented super method reference node
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public SuperMethodReference newSuperMethodReference() {
SuperMethodReference result = new SuperMethodReference(this);
@@ -2689,7 +2689,7 @@
*
* @return a new unparented type method reference node
* @exception UnsupportedOperationException if this operation is used in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public TypeMethodReference newTypeMethodReference() {
TypeMethodReference result = new TypeMethodReference(this);
@@ -2730,7 +2730,7 @@
* @return a new unparented IntersectionType node
* @exception UnsupportedOperationException if this operation is used in
* a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public IntersectionType newIntersectionType() {
return new IntersectionType(this);
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 d709f04..23ca2f3 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
@@ -703,7 +703,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(CreationReference node, Object other) {
if (!(other instanceof CreationReference)) {
@@ -860,7 +860,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(ExpressionMethodReference node, Object other) {
if (!(other instanceof ExpressionMethodReference)) {
@@ -908,7 +908,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(ExtraDimension node, Object other) {
if (!(other instanceof ExtraDimension)) {
@@ -1164,7 +1164,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(IntersectionType node, Object other) {
if (!(other instanceof IntersectionType)) {
@@ -1263,7 +1263,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(LambdaExpression node, Object other) {
if (!(other instanceof LambdaExpression)) {
@@ -1649,7 +1649,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(PackageQualifiedType node, Object other) {
if (!(other instanceof PackageQualifiedType)) {
@@ -2080,7 +2080,7 @@
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(SuperMethodReference node, Object other) {
if (!(other instanceof SuperMethodReference)) {
@@ -2397,7 +2397,7 @@
* @return <code>true</code> if the subtree matches, or
* <code>false</code> if they do not match or the other object has a
* different node type or is <code>null</code>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean match(TypeMethodReference node, Object other) {
if (!(other instanceof TypeMethodReference)) {
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 b15e8a6..8300e26 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
@@ -840,7 +840,7 @@
* <code>ExtraDimension</code>.
*
* @see ExtraDimension
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int EXTRA_DIMENSION = 85;
@@ -848,7 +848,7 @@
* Node type constant indicating a node of type
* <code>LambdaExpression</code>.
* @see LambdaExpression
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int LAMBDA_EXPRESSION = 86;
@@ -857,7 +857,7 @@
* <code>IntersectionType</code>.
*
* @see IntersectionType
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int INTERSECTION_TYPE = 87;
@@ -865,7 +865,7 @@
* Node type constant indicating a node of type
* <code>QualifiedType</code>.
* @see QualifiedType
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAV8
*/
public static final int PACKAGE_QUALIFIED_TYPE = 88;
@@ -873,7 +873,7 @@
* Node type constant indicating a node of type
* <code>CreationReference</code>.
* @see CreationReference
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAV8
*/
public static final int CREATION_REFERENCE = 89;
@@ -881,7 +881,7 @@
* Node type constant indicating a node of type
* <code>ExpressionMethodReference</code>.
* @see ExpressionMethodReference
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAV8
*/
public static final int EXPRESSION_METHOD_REFERENCE = 90;
@@ -889,7 +889,7 @@
* Node type constant indicating a node of type
* <code>SuperMethhodReference</code>.
* @see SuperMethodReference
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAV8
*/
public static final int SUPER_METHOD_REFERENCE = 91;
@@ -897,7 +897,7 @@
* Node type constant indicating a node of type
* <code>TypeMethodReference</code>.
* @see TypeMethodReference
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAV8
*/
public static final int TYPE_METHOD_REFERENCE = 92;
@@ -2092,7 +2092,7 @@
* </p>
*
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final void unsupportedIn2_3_4() {
if (this.ast.apiLevel < AST.JLS8) {
@@ -2125,7 +2125,7 @@
* </p>
*
* @exception UnsupportedOperationException if this operation is used in an AST later than JLS4
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
// In API Javadocs, add: * @deprecated In the JLS8 API, this method is replaced by {@link #replacement()}.
final void supportedOnlyIn2_3_4() {
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 4eba101..7481d0b 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
@@ -544,7 +544,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(CreationReference node) {
return true;
@@ -644,7 +644,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(ExpressionMethodReference node) {
return true;
@@ -677,7 +677,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(ExtraDimension node) {
return true;
@@ -822,7 +822,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(IntersectionType node) {
return true;
@@ -878,7 +878,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(LambdaExpression node) {
return true;
@@ -1125,7 +1125,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(PackageQualifiedType node) {
return true;
@@ -1403,7 +1403,7 @@
* @return <code>true</code> if the children of this node should be
* visited, and <code>false</code> if the children of this node should
* be skipped
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(SuperMethodReference node) {
return true;
@@ -1601,7 +1601,7 @@
* visited, and <code>false</code> if the children of this node should
* be skipped
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(TypeMethodReference node) {
return true;
@@ -2251,7 +2251,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(CreationReference node) {
// default implementation: do nothing
@@ -2327,7 +2327,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(ExpressionMethodReference node) {
// default implementation: do nothing
@@ -2352,7 +2352,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(ExtraDimension node) {
// do nothing by default
@@ -2485,7 +2485,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(LambdaExpression node) {
// default implementation: do nothing
@@ -2667,7 +2667,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(PackageQualifiedType node) {
// default implementation: do nothing
@@ -2875,7 +2875,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(SuperMethodReference node) {
// default implementation: do nothing
@@ -3022,7 +3022,7 @@
*
* @param node the node to visit
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(TypeMethodReference node) {
// default implementation: do nothing
@@ -3061,7 +3061,7 @@
* </p>
*
* @param node the node to visit
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void endVisit(IntersectionType node) {
// default implementation: do nothing
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotatableType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotatableType.java
index 1ad20d7..8b2c16d 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotatableType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotatableType.java
@@ -22,7 +22,7 @@
* Introduced in JLS8, type references that can be annotated are represented by
* AnnotatableType. For the list of types extending AnnotatableType, see {@link Type}.</p>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public abstract class AnnotatableType extends Type {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java
index 9e01953..cd1dd83 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java
@@ -42,7 +42,7 @@
/**
* The "annotations" structural property of this node type (element type: {@link Annotation}).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
internalAnnotationsPropertyFactory(ArrayType.class);
@@ -57,7 +57,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -117,7 +117,7 @@
/* (omit javadoc for this method)
* Method declared on AnnotatableType.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalAnnotationsProperty() {
return ANNOTATIONS_PROPERTY;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
index aa869a1..085fe73 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java
@@ -603,7 +603,7 @@
* @param methodReference the method reference of interest
* @return the binding for the given method reference, or
* <code>null</code> if no binding is available
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
IMethodBinding resolveMethod(MethodReference methodReference) {
return null;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CreationReference.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CreationReference.java
index 3f2faf3..13602f0 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CreationReference.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CreationReference.java
@@ -27,7 +27,7 @@
* <b>new</b>
* </pre>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class CreationReference extends MethodReference {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionMethodReference.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionMethodReference.java
index f3ceaf5..b98eba8 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionMethodReference.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionMethodReference.java
@@ -26,7 +26,7 @@
* Identifier
* </pre>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class ExpressionMethodReference extends MethodReference {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExtraDimension.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExtraDimension.java
index f96c7e1..306abe9 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExtraDimension.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExtraDimension.java
@@ -31,7 +31,7 @@
* { Annotation } <b>[]</b>
* </pre>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class ExtraDimension extends ASTNode {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java
index 7ca284a..b30bc25 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java
@@ -1,10 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
- * $Id: IBinding.java 19895 2009-04-15 13:52:23Z stephan $
+ *
+ * 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
@@ -154,9 +157,13 @@
/**
* Returns the modifiers for this binding.
* <p>
- * Note that deprecated is not included among the modifiers.
+ * Note that 'deprecated' is not included among the modifiers.
* Use <code>isDeprecated</code> to find out whether a binding is deprecated.
* </p>
+ * <p>
+ * Note that 'default' is not included among the modifiers.
+ * Default methods are interface methods that are neither abstract nor static.
+ * </p>
*
* @return the bit-wise or of <code>Modifier</code> constants
* @see Modifier
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ITypeBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ITypeBinding.java
index 6d7a4b7..0adf7bf 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ITypeBinding.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ITypeBinding.java
@@ -755,7 +755,7 @@
*
* @return <code>true</code> if this object represents a functional interface,
* and <code>false</code> otherwise
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean isFunctionalInterface();
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java
index 89223af..df210fd 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java
@@ -28,7 +28,7 @@
* This kind of node is used only inside a cast expression.
* </p>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class IntersectionType extends Type {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java
index 8eb2978..35fa5b5 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java
@@ -31,7 +31,7 @@
* while the third form uses {@link SingleVariableDeclaration}.</p>
*<p>The Body can be either a {@link Block} or an {@link Expression}.</p>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients
*/
public class LambdaExpression extends Expression {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
index 8b33787..aa45e2f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java
@@ -126,7 +126,7 @@
/**
* The "extraDimensions2" structural property of this node type (element type: {@link ExtraDimension}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor EXTRA_DIMENSIONS2_PROPERTY =
new ChildListPropertyDescriptor(MethodDeclaration.class, "extraDimensions2", ExtraDimension.class, NO_CYCLE_RISK); //$NON-NLS-1$
@@ -147,14 +147,14 @@
/**
* The "receiverType" structural property of this node type (child type: {@link AnnotatableType}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildPropertyDescriptor RECEIVER_TYPE_PROPERTY =
new ChildPropertyDescriptor(MethodDeclaration.class, "receiverType", AnnotatableType.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
/**
* The "receiverQualifier" structural property of this node type (child type: {@link SimpleName}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildPropertyDescriptor RECEIVER_QUALIFIER_PROPERTY =
new ChildPropertyDescriptor(MethodDeclaration.class, "receiverQualifier", SimpleName.class, OPTIONAL, NO_CYCLE_RISK); //$NON-NLS-1$
@@ -169,7 +169,7 @@
/**
* The "thrownExceptionTypes" structural property of this node type (element type: {@link Type}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor THROWN_EXCEPTION_TYPES_PROPERTY =
new ChildListPropertyDescriptor(MethodDeclaration.class, "thrownExceptionTypes", Type.class, NO_CYCLE_RISK); //$NON-NLS-1$
@@ -210,7 +210,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -302,14 +302,14 @@
/**
* The explicit receiver type, or <code>null</code> if none.
* Defaults to none.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private AnnotatableType optionalReceiverType = null;
/**
* Qualifying name of the explicit </code>this</code> parameter, or <code>null</code> if none.
* Defaults to none.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private SimpleName optionalReceiverQualifier = null;
@@ -358,7 +358,7 @@
* Null before JLS8. Added in JLS8; defaults to an empty list
* (see constructor).
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private ASTNode.NodeList extraDimensions = null;
@@ -375,7 +375,7 @@
* Null before JLS8. Added in JLS8; defaults to an empty list
* (see constructor).
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private ASTNode.NodeList thrownExceptionTypes = null;
@@ -774,7 +774,7 @@
*
* @return the receiver type or <code>null</code> if receiver is not declared explicitly
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public AnnotatableType getReceiverType() {
unsupportedIn2_3_4();
@@ -789,7 +789,7 @@
*
* @param receiverType type of the explicit receiver parameter, or <code>null</code> if there is none
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void setReceiverType(AnnotatableType receiverType) {
unsupportedIn2_3_4();
@@ -807,7 +807,7 @@
*
* @returns the qualifying name or <code>null</code> if a qualifier was not specified
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public SimpleName getReceiverQualifier() {
unsupportedIn2_3_4();
@@ -819,7 +819,7 @@
*
* @param receiverQualifier explicit receiver parameter to be added to the method declaration
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public void setReceiverQualifier(SimpleName receiverQualifier) {
unsupportedIn2_3_4();
@@ -884,7 +884,7 @@
* deprecation warnings.
* @exception UnsupportedOperationException if this operation is used in
* a JLS8 or later AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
/*package*/ List internalThrownExceptions() {
// more efficient than just calling supportedOnlyIn2_3_4() to check
@@ -902,7 +902,7 @@
* (element type: {@link Type})
* @exception UnsupportedOperationException if this operation is used
* in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public List thrownExceptionTypes() {
if (this.thrownExceptionTypes == null) {
@@ -1127,7 +1127,7 @@
*
* @return the live list of extra dimensions with optional annotations (element type: {@link ExtraDimension})
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public List extraDimensions() {
// more efficient than just calling unsupportedIn2_3_4() to check
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodReference.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodReference.java
index 54edda3..b7cfe30 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodReference.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodReference.java
@@ -38,7 +38,7 @@
* @see ExpressionMethodReference
* @see SuperMethodReference
* @see TypeMethodReference
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public abstract class MethodReference extends Expression {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
index 62c4c0a..04dfa64 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java
@@ -104,7 +104,7 @@
* Note that the value of this modifier is
* internal and is not specified in the Java Virtual Machine Specification.
* </p>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ModifierKeyword DEFAULT_KEYWORD = new ModifierKeyword("default", DEFAULT);//$NON-NLS-1$
@@ -358,7 +358,7 @@
* Note that the value of this flag is internal and is not
* specified in the Java Virtual Machine Specification.
* </p>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int DEFAULT = 0x10000;
@@ -567,12 +567,12 @@
/**
* Returns whether the given flags includes the "default" modifier.
- * Applicable only to methods.
+ * Applicable only to methods in interfaces.
*
* @param flags the modifier flags
* @return <code>true</code> if the <code>DEFAULT</code> bit is set
* and <code>false</code> otherwise
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static boolean isDefault(int flags) {
return (flags & DEFAULT) != 0;
@@ -893,7 +893,7 @@
/**
* Answer true if the receiver is the default modifier, false otherwise.
* @return true if the receiver is the default modifier, false otherwise
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean isDefault() {
return this.modifierKeyword == ModifierKeyword.DEFAULT_KEYWORD;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageQualifiedType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageQualifiedType.java
index f615ad0..b3154b4 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageQualifiedType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageQualifiedType.java
@@ -35,7 +35,7 @@
* @see SimpleType
* @see QualifiedType
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class PackageQualifiedType extends AnnotatableType {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java
index 9260c4e..948c32c 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java
@@ -160,7 +160,7 @@
/**
* The "annotations" structural property of this node type (element type: {@link Annotation}).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
internalAnnotationsPropertyFactory(PrimitiveType.class);
@@ -182,7 +182,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
static {
@@ -235,7 +235,7 @@
/* (omit javadoc for this method)
* Method declared on AnnotatableType.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalAnnotationsProperty() {
return ANNOTATIONS_PROPERTY;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java
index fc0420d..b3b549f 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java
@@ -78,7 +78,7 @@
/**
* The "annotations" structural property of this node type (element type: {@link Annotation}).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
internalAnnotationsPropertyFactory(QualifiedType.class);
@@ -99,7 +99,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -166,7 +166,7 @@
/* (omit javadoc for this method)
* Method declared on AnnotatableType.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalAnnotationsProperty() {
return ANNOTATIONS_PROPERTY;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java
index 23bafd8..91818f4 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java
@@ -43,7 +43,7 @@
/**
* The "annotations" structural property of this node type (element type: {@link Annotation}).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
internalAnnotationsPropertyFactory(SimpleType.class);
@@ -65,7 +65,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -124,7 +124,7 @@
/* (omit javadoc for this method)
* Method declared on AnnotatableType.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalAnnotationsProperty() {
return ANNOTATIONS_PROPERTY;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java
index e1957d8..d5b0439 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java
@@ -62,7 +62,7 @@
/**
* The "varargsAnnotations" structural property of variable arguments of this node type (element type: {@link Annotation})
* (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor VARARGS_ANNOTATIONS_PROPERTY =
new ChildListPropertyDescriptor(SingleVariableDeclaration.class, "varargsAnnotations", Annotation.class, CYCLE_RISK); //$NON-NLS-1$
@@ -93,7 +93,7 @@
/**
* The "extraDimensions2" structural property of this node type (element type: {@link ExtraDimension}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor EXTRA_DIMENSIONS2_PROPERTY =
internalExtraDimensions2PropertyFactory(SingleVariableDeclaration.class);
@@ -125,7 +125,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -207,7 +207,7 @@
* Null before JLS8. Added in JLS8; defaults to an empty list
* (see constructor).
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private ASTNode.NodeList varargsAnnotations = null;
@@ -292,7 +292,7 @@
/* (omit javadoc for this method)
* Method declared on VariableDeclaration.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalExtraDimensions2Property() {
return EXTRA_DIMENSIONS2_PROPERTY;
@@ -644,7 +644,7 @@
* @return the list of annotations on the varargs token (element type: {@link Annotation})
* @exception UnsupportedOperationException if this operation is used
* in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public List varargsAnnotations() {
if (this.varargsAnnotations == null) {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodReference.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodReference.java
index 65d6aef..0dfbc2e 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodReference.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodReference.java
@@ -27,7 +27,7 @@
* Identifier
* </pre>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients
*/
public class SuperMethodReference extends MethodReference {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Type.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Type.java
index 4e9c5e4..336deda 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Type.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Type.java
@@ -123,7 +123,7 @@
*
* @return <code>true</code> if this is a package qualified type, and
* <code>false</code> otherwise
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public final boolean isPackageQualifiedType() {
return (this instanceof PackageQualifiedType);
@@ -187,7 +187,7 @@
*
* @return <code>true</code> if this is an intersection type, and
* <code>false</code> otherwise
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public final boolean isIntersectionType() {
return (this instanceof IntersectionType);
@@ -216,7 +216,7 @@
* @return <code>true</code> if this type is an instance of {@link AnnotatableType}, and
* <code>false</code> otherwise
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean isAnnotatable() {
return (this instanceof AnnotatableType);
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeMethodReference.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeMethodReference.java
index 0393cb2..1cebbe4 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeMethodReference.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeMethodReference.java
@@ -26,7 +26,7 @@
* Identifier
* </pre>
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class TypeMethodReference extends MethodReference {
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java
index ac7ec9f..82c0481 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java
@@ -34,7 +34,7 @@
/**
* The "annotations" structural property of this node type (element type: {@link Annotation}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
new ChildListPropertyDescriptor(TypeParameter.class, "annotations", Annotation.class, CYCLE_RISK); //$NON-NLS-1$
@@ -68,7 +68,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -332,7 +332,7 @@
* @return the live list of annotations (element type: {@link Annotation})
* @exception UnsupportedOperationException if this operation is used
* in a JLS2, JLS3 or JLS4 AST
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public List annotations() {
// more efficient than just calling unsupportedIn2_3_4() to check
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclaration.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclaration.java
index 0b38051..c13bd9b 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclaration.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclaration.java
@@ -51,7 +51,7 @@
* Null before JLS8. Added in JLS8; defaults to an empty list
* (see constructor).
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
ASTNode.NodeList extraDimensions = null;
@@ -150,7 +150,7 @@
* of this node (element type: {@link ExtraDimension}) (added in JLS8 API).
*
* @return the property descriptor
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
abstract ChildListPropertyDescriptor internalExtraDimensions2Property();
@@ -159,7 +159,7 @@
* of this node (element type: {@link ExtraDimension}) (added in JLS8 API).
*
* @return the property descriptor
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public final ChildListPropertyDescriptor getExtraDimensions2Property() {
return internalExtraDimensions2Property();
@@ -298,7 +298,7 @@
/**
* Internal synonym for deprecated method. Used to avoid
* deprecation warnings.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final void internalSetExtraDimensions(int dimensions) {
// more efficient than just calling supportedOnlyIn2_3_4() to check
@@ -319,7 +319,7 @@
*
* @return the live list of extra dimensions with optional annotations (element type: {@link ExtraDimension})
* @exception UnsupportedOperationException if this operation is used below JLS8
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public List extraDimensions() {
// more efficient than just calling unsupportedIn2_3_4() to check
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java
index bd0d6f1..7d990e9 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java
@@ -48,7 +48,7 @@
/**
* The "extraDimensions2" structural property of this node type (element type: {@link ExtraDimension}) (added in JLS8 API).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor EXTRA_DIMENSIONS2_PROPERTY =
internalExtraDimensions2PropertyFactory(VariableDeclarationFragment.class);
@@ -72,7 +72,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -142,7 +142,7 @@
/* (omit javadoc for this method)
* Method declared on VariableDeclaration.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalExtraDimensions2Property() {
return EXTRA_DIMENSIONS2_PROPERTY;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java
index 0d8cfac..93fd054 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java
@@ -37,7 +37,7 @@
/**
* The "annotations" structural property of this node type (element type: {@link Annotation}).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final ChildListPropertyDescriptor ANNOTATIONS_PROPERTY =
internalAnnotationsPropertyFactory(WildcardType.class);
@@ -64,7 +64,7 @@
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final List PROPERTY_DESCRIPTORS_8_0;
@@ -133,7 +133,7 @@
/* (omit javadoc for this method)
* Method declared on AnnotatableType.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
final ChildListPropertyDescriptor internalAnnotationsProperty() {
return ANNOTATIONS_PROPERTY;
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 6d7e214..3a1f4b5 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
@@ -64,7 +64,7 @@
* Internal synonym for {@link AST#JLS4}. Use to alleviate
* deprecation warnings.
* @deprecated
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static final int JLS4 = AST.JLS4;
@@ -136,7 +136,7 @@
* Internal synonym for {@link MethodDeclaration#thrownExceptions()}. Use to alleviate
* deprecation warnings.
* @deprecated
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
private static List thrownExceptions(MethodDeclaration node) {
return node.thrownExceptions();
@@ -603,7 +603,7 @@
/*
* @see ASTVisitor#visit(CreationReference)
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(CreationReference node) {
node.getType().accept(this);
@@ -726,7 +726,7 @@
/*
* @see ASTVisitor#visit(ExpressionMethodReference)
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(ExpressionMethodReference node) {
node.getExpression().accept(this);
@@ -1263,7 +1263,7 @@
/*
* @see ASTVisitor#visit(PackageQualifiedType)
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(PackageQualifiedType node) {
node.getQualifier().accept(this);
@@ -1540,7 +1540,7 @@
/*
* @see ASTVisitor#visit(SuperMethodReference)
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(SuperMethodReference node) {
if (node.getQualifier() != null) {
@@ -1812,7 +1812,7 @@
/*
* @see ASTVisitor#visit(TypeMethodReference)
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(TypeMethodReference node) {
node.getType().accept(this);
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 88b603c..709b6d5 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
@@ -1490,7 +1490,7 @@
/*
* @see ASTVisitor#visit(PackageQualifiedType)
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public boolean visit(PackageQualifiedType node) {
getChildNode(node, PackageQualifiedType.QUALIFIER_PROPERTY).accept(this);
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
index 03b9f79..f5297c7 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java
@@ -14,6 +14,7 @@
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409245 - [1.8][compiler] Type annotations dropped when call is routed through a synthetic bridge method
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.eval;
@@ -92,7 +93,7 @@
if (this.arguments != null) {
int argsLength = this.arguments.length;
codeStream.generateInlinedValue(argsLength);
- codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
+ codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
codeStream.dup();
for (int i = 0; i < argsLength; i++) {
codeStream.generateInlinedValue(i);
@@ -108,7 +109,7 @@
}
} else {
codeStream.generateInlinedValue(0);
- codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
+ codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
}
codeStream.invokeJavaLangReflectConstructorNewInstance();
codeStream.checkcast(allocatedType);
diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
index a3246c2..4ea1ff8 100644
--- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
+++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java
@@ -16,6 +16,7 @@
* Technical University Berlin - extended API and implementation
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 409245 - [1.8][compiler] Type annotations dropped when call is routed through a synthetic bridge method
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.eval;
@@ -121,7 +122,7 @@
if (this.arguments != null) {
int argsLength = this.arguments.length;
codeStream.generateInlinedValue(argsLength);
- codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
+ codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
codeStream.dup();
for (int i = 0; i < argsLength; i++) {
codeStream.generateInlinedValue(i);
@@ -137,7 +138,7 @@
}
} else {
codeStream.generateInlinedValue(0);
- codeStream.newArray(null, currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
+ codeStream.newArray(currentScope.createArrayType(currentScope.getType(TypeConstants.JAVA_LANG_OBJECT, 3), 1));
}
codeStream.invokeJavaLangReflectMethodInvoke();
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
index 03cfc31..416d78c 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java
@@ -624,7 +624,7 @@
* @see #NEXT_LINE
* @see #NEXT_LINE_SHIFTED
* @see #NEXT_LINE_ON_WRAP
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final String FORMATTER_BRACE_POSITION_FOR_LAMBDA_BODY = JavaCore.PLUGIN_ID + ".formatter.brace_position_for_lambda_body"; //$NON-NLS-1$
@@ -2030,7 +2030,7 @@
* </pre>
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final String FORMATTER_INSERT_SPACE_AFTER_LAMBDA_ARROW = JavaCore.PLUGIN_ID + ".formatter.insert_space_after_lambda_arrow"; //$NON-NLS-1$
/**
@@ -2967,7 +2967,7 @@
* </pre>
* @see JavaCore#INSERT
* @see JavaCore#DO_NOT_INSERT
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final String FORMATTER_INSERT_SPACE_BEFORE_LAMBDA_ARROW = JavaCore.PLUGIN_ID + ".formatter.insert_space_before_lambda_arrow"; //$NON-NLS-1$
/**
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
index a1f811f..d735737 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java
@@ -310,6 +310,7 @@
optionsMap.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
optionsMap.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
optionsMap.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE);
+ optionsMap.put(CompilerOptions.OPTION_MethodParametersAttribute, CompilerOptions.DO_NOT_GENERATE);
optionsMap.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
optionsMap.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.DISABLED);
optionsMap.put(CompilerOptions.OPTION_ReportMethodWithConstructorName, CompilerOptions.IGNORE);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java
index cc86e9c..c04334e 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java
@@ -183,7 +183,7 @@
* Note that this flag's value is internal and is not defined in the
* Virtual Machine specification.
* </p>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int AccDefaultMethod = ExtraCompilerModifiers.AccDefaultMethod;
@@ -194,7 +194,7 @@
* Note that this flag's value is internal and is not defined in the
* Virtual Machine specification.
* </p>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static final int AccAnnotationDefault = ClassFileConstants.AccAnnotationDefault;
@@ -414,7 +414,7 @@
*
* @return <code>true</code> if the <code>AccDefaultMethod</code> flag is included
* @see #AccDefaultMethod
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static boolean isDefaultMethod(int flags) {
return (flags & AccDefaultMethod) != 0;
@@ -461,7 +461,7 @@
*
* @return <code>true</code> if the <code>AccAnnotationDefault</code> flag is included
* @see #AccAnnotationDefault
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public static boolean isAnnnotationDefault(int flags) {
return (flags & AccAnnotationDefault) != 0;
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 f2d5948..e3e9d52 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
@@ -295,7 +295,7 @@
* <dt>Possible values:</dt><dd><code>{ "generate", "do not generate" }</code></dd>
* <dt>Default:</dt><dd><code>"do not generate"</code></dd>
* </dl>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @category CompilerOptionID
*/
public static final String COMPILER_CODEGEN_METHOD_PARAMETERS_ATTR = PLUGIN_ID + ".compiler.codegen.methodParameters"; //$NON-NLS-1$
@@ -2680,7 +2680,7 @@
public static final String VERSION_1_7 = "1.7"; //$NON-NLS-1$
/**
* Configurable option value: {@value}.
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @category OptionValue
*/
public static final String VERSION_1_8 = "1.8"; //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java
index 81ae540..df1686f 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java
@@ -171,11 +171,11 @@
int TokenNamegoto = 404; // goto not found in Java ? :)
/**
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
int TokenNameARROW = 405;
/**
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
int TokenNameCOLON_COLON = 406;
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java
index 5c1920c..34dba48 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java
@@ -162,7 +162,7 @@
* <ul>
* <li> The working copy does not exist (ELEMENT_DOES_NOT_EXIST)</li>
* </ul>
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public org.eclipse.jdt.core.dom.CompilationUnit getAST8() throws JavaModelException {
if (this.operation.astLevel != AST.JLS8 || !this.operation.resolveBindings) {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
index fbe8ae1..da7d26b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java
@@ -151,13 +151,13 @@
/**
* "RuntimeVisibleTypeAnnotations" attribute (added in jsr 308).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
char[] RUNTIME_VISIBLE_TYPE_ANNOTATIONS = "RuntimeVisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
/**
* "RuntimeInvisibleTypeAnnotations" attribute (added in jsr 308).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
char[] RUNTIME_INVISIBLE_TYPE_ANNOTATIONS = "RuntimeInvisibleTypeAnnotations".toCharArray(); //$NON-NLS-1$
@@ -170,7 +170,7 @@
/**
* "MethodParameters" attribute (added in jep118).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
char[] METHOD_PARAMETERS = "MethodParameters".toCharArray(); //$NON-NLS-1$
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java
index 76edd25..2e96e72 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java
@@ -13,6 +13,7 @@
* IBM Corporation - initial API and implementation
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.core.util;
@@ -22,7 +23,7 @@
*
* This interface may be implemented by clients.
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public interface IExtendedAnnotation extends IAnnotation {
/**
@@ -73,7 +74,7 @@
* Answer back the local variable reference info table length of this entry as specified in
* the JVM specifications.
*
- * <p>This is defined only for annotations related a local variable.</p>
+ * <p>This is defined only for annotations related to a local variable.</p>
*
* @return the local variable reference info table length of this entry as specified in
* the JVM specifications
@@ -84,7 +85,7 @@
* Answer back the local variable reference info table of this entry as specified in
* the JVM specifications. Answer an empty array if none.
*
- * <p>This is defined only for annotations related a local variable.</p>
+ * <p>This is defined only for annotations related to a local variable.</p>
*
* @return the local variable reference info table of this entry as specified in
* the JVM specifications. Answer an empty array if none
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java
index ddadcfc..c849076 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java
@@ -22,7 +22,7 @@
* Description of an extended annotation target types constants as described in the JVM specifications
* (added in JavaSE-1.8).
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
* @noimplement This interface is not intended to be implemented by clients.
* @noextend This interface is not intended to be extended by clients.
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java
index a2e8e77..f3de2c5 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java
@@ -21,7 +21,7 @@
*
* This interface may be implemented by clients.
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public interface ILocalVariableReferenceInfo {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodParametersAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodParametersAttribute.java
index c98ce3c..def60c9 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodParametersAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodParametersAttribute.java
@@ -19,7 +19,7 @@
*
* This interface may be implemented by clients.
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public interface IMethodParametersAttribute extends IClassFileAttribute {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModifierConstants.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModifierConstants.java
index eb854f5..87402aa 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModifierConstants.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModifierConstants.java
@@ -69,7 +69,7 @@
/**
* Indicates a mandated parameter, such as this$1 (added in Java SE 8).
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
int ACC_MANDATED = 0x8000;
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java
index 7dfb343..f94d105 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java
@@ -22,7 +22,7 @@
*
* This interface may be implemented by clients.
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public interface IRuntimeInvisibleTypeAnnotationsAttribute extends IClassFileAttribute {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java
index aafb825..3564599 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java
@@ -22,7 +22,7 @@
*
* This interface may be implemented by clients.
*
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public interface IRuntimeVisibleTypeAnnotationsAttribute extends IClassFileAttribute {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
index c8f98e4..c08a006 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java
@@ -597,7 +597,7 @@
tabNumber += 2;
writeNewLine(buffer, lineSeparator, tabNumber);
buffer.append(Messages.disassembler_methodparametersheader);
- for (int i = 0; i < methodParametersAttribute.getMethodParameterLength(); ++i) {
+ for (int i = 0, length = methodParametersAttribute.getMethodParameterLength(); i < length; ++i) {
writeNewLine(buffer, lineSeparator, tabNumber + 1);
short accessFlags = methodParametersAttribute.getAccessFlags(i);
decodeModifiersForMethodParameters(buffer, accessFlags);
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java
index aa6187b..85e80f0 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java
@@ -14,6 +14,7 @@
* Andy Clement (GoPivotal, Inc) aclement@gopivotal.com - Contributions for
* Bug 383624 - [1.8][compiler] Revive code generation support for type annotations (from Olivier's work)
* Bug 409236 - [1.8][compiler] Type annotations on intersection cast types dropped by code generator
+ * Bug 409250 - [1.8][compiler] Various loose ends in 308 code generation
*******************************************************************************/
package org.eclipse.jdt.internal.core.util;
@@ -53,12 +54,13 @@
} element_value_pairs[num_element_value_pairs];
*/
/**
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public class ExtendedAnnotation extends ClassFileStruct implements IExtendedAnnotation {
private static final IAnnotationComponent[] NO_ENTRIES = new IAnnotationComponent[0];
private final static int[][] NO_TYPEPATH = new int[0][0];
+ private final static ILocalVariableReferenceInfo[] NO_LOCAL_VARIABLE_TABLE_ENTRIES = new ILocalVariableReferenceInfo[0];
private int targetType;
private int annotationTypeIndex;
@@ -74,7 +76,7 @@
private int typeParameterBoundIndex;
private int parameterIndex;
private int exceptionTableIndex;
- private ILocalVariableReferenceInfo[] localVariableTable;
+ private ILocalVariableReferenceInfo[] localVariableTable = NO_LOCAL_VARIABLE_TABLE_ENTRIES;
/**
* Constructor for ExtendedAnnotation, builds an annotation from the supplied bytestream.
@@ -271,7 +273,7 @@
}
public int getLocalVariableRefenceInfoLength() {
- return this.localVariableTable != null ? this.localVariableTable.length : 0;
+ return this.localVariableTable.length;
}
public ILocalVariableReferenceInfo[] getLocalVariableTable() {
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java
index a6d998a..10ce77b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java
@@ -22,7 +22,7 @@
import org.eclipse.jdt.core.util.IMethodParametersAttribute;
/**
- * @since 3.10 BETA_JAVA8
+ * @since 3.9 BETA_JAVA8
*/
public class MethodParametersAttribute extends ClassFileAttribute implements IMethodParametersAttribute {
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index 4e908bf..86146f5 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.4.0-SNAPSHOT</version>
+ <version>4.3.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.core</artifactId>
- <version>3.10.0-SNAPSHOT</version>
+ <version>3.9.1-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>