Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2022-11-17 18:21:57 +0000
committerStephan Herrmann2022-11-24 21:56:13 +0000
commitb14533549d9d86290f0f158a50e6b2dd893bb1b8 (patch)
treecf5467ecf1be39377fdc99653be807fe05c71521
parent45caf135554b74f6389762d65edb8359bec86ab7 (diff)
downloadorg.eclipse.objectteams-b14533549d9d86290f0f158a50e6b2dd893bb1b8.tar.gz
org.eclipse.objectteams-b14533549d9d86290f0f158a50e6b2dd893bb1b8.tar.xz
org.eclipse.objectteams-b14533549d9d86290f0f158a50e6b2dd893bb1b8.zip
update jdt.core to I20221109-1850 for 4.26 M3
-rw-r--r--JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java7
-rw-r--r--JCL/converterJclMin17/.project11
-rw-r--r--JCL/converterJclMin17/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--JCL/converterJclMin17/src/javax/lang/model/SourceVersion.java69
-rw-r--r--JCL/converterJclMin18/.project11
-rw-r--r--JCL/converterJclMin18/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--JCL/converterJclMin18/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--JCL/converterJclMin18/src/META-INF/MANIFEST.MF3
-rw-r--r--JCL/converterJclMin18/src/java/io/InputStream.java5
-rw-r--r--JCL/converterJclMin18/src/java/io/PrintStream.java8
-rw-r--r--JCL/converterJclMin18/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin18/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/ClassNotFoundException.java20
-rw-r--r--JCL/converterJclMin18/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin18/src/java/lang/Enum.java18
-rw-r--r--JCL/converterJclMin18/src/java/lang/Error.java16
-rw-r--r--JCL/converterJclMin18/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin18/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin18/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/IncompatibleClassChangeError.java13
-rw-r--r--JCL/converterJclMin18/src/java/lang/Integer.java59
-rw-r--r--JCL/converterJclMin18/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/Iterable.java10
-rw-r--r--JCL/converterJclMin18/src/java/lang/LinkageError.java17
-rw-r--r--JCL/converterJclMin18/src/java/lang/NoClassDefFoundError.java13
-rw-r--r--JCL/converterJclMin18/src/java/lang/NoSuchFieldError.java13
-rw-r--r--JCL/converterJclMin18/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin18/src/java/lang/NullPointerException.java11
-rw-r--r--JCL/converterJclMin18/src/java/lang/Number.java29
-rw-r--r--JCL/converterJclMin18/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin18/src/java/lang/Override.java7
-rw-r--r--JCL/converterJclMin18/src/java/lang/Record.java9
-rw-r--r--JCL/converterJclMin18/src/java/lang/ReflectiveOperationException.java26
-rw-r--r--JCL/converterJclMin18/src/java/lang/RuntimeException.java12
-rw-r--r--JCL/converterJclMin18/src/java/lang/String.java8
-rw-r--r--JCL/converterJclMin18/src/java/lang/System.java20
-rw-r--r--JCL/converterJclMin18/src/java/lang/Throwable.java20
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/Documented.java12
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/ElementType.java48
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/Inherited.java13
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/Retention.java14
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin18/src/java/lang/annotation/Target.java14
-rw-r--r--JCL/converterJclMin18/src/java/lang/invoke/MethodHandle.java39
-rw-r--r--JCL/converterJclMin18/src/java/lang/invoke/MethodHandles.java22
-rw-r--r--JCL/converterJclMin18/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin18/src/java/lang/invoke/TypeDescriptor.java31
-rw-r--r--JCL/converterJclMin18/src/java/lang/runtime/ObjectMethods.java14
-rw-r--r--JCL/converterJclMin18/src/java/lang/runtime/SwitchBootstraps.java30
-rw-r--r--JCL/converterJclMin18/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin18/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin18/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin18/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin18/src/java/util/function/Consumer.java10
-rw-r--r--JCL/converterJclMin18/src/javax/lang/model/SourceVersion.java70
-rw-r--r--JCL/converterJclMin18/src/module-info.java7
-rw-r--r--JCL/converterJclMin19/.project11
-rw-r--r--JCL/converterJclMin19/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--JCL/converterJclMin19/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--JCL/converterJclMin19/src/META-INF/MANIFEST.MF3
-rw-r--r--JCL/converterJclMin19/src/java/io/InputStream.java5
-rw-r--r--JCL/converterJclMin19/src/java/io/PrintStream.java8
-rw-r--r--JCL/converterJclMin19/src/java/io/Serializable.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/CharSequence.java5
-rw-r--r--JCL/converterJclMin19/src/java/lang/Class.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/ClassNotFoundException.java20
-rw-r--r--JCL/converterJclMin19/src/java/lang/CloneNotSupportedException.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/Comparable.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/Deprecated.java6
-rw-r--r--JCL/converterJclMin19/src/java/lang/Enum.java18
-rw-r--r--JCL/converterJclMin19/src/java/lang/Error.java16
-rw-r--r--JCL/converterJclMin19/src/java/lang/Exception.java19
-rw-r--r--JCL/converterJclMin19/src/java/lang/IllegalAccessException.java5
-rw-r--r--JCL/converterJclMin19/src/java/lang/IllegalMonitorStateException.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/IncompatibleClassChangeError.java13
-rw-r--r--JCL/converterJclMin19/src/java/lang/Integer.java59
-rw-r--r--JCL/converterJclMin19/src/java/lang/InterruptedException.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/Iterable.java10
-rw-r--r--JCL/converterJclMin19/src/java/lang/LinkageError.java17
-rw-r--r--JCL/converterJclMin19/src/java/lang/NoClassDefFoundError.java13
-rw-r--r--JCL/converterJclMin19/src/java/lang/NoSuchFieldError.java13
-rw-r--r--JCL/converterJclMin19/src/java/lang/NoSuchMethodException.java5
-rw-r--r--JCL/converterJclMin19/src/java/lang/NullPointerException.java11
-rw-r--r--JCL/converterJclMin19/src/java/lang/Number.java29
-rw-r--r--JCL/converterJclMin19/src/java/lang/Object.java34
-rw-r--r--JCL/converterJclMin19/src/java/lang/Override.java7
-rw-r--r--JCL/converterJclMin19/src/java/lang/Record.java9
-rw-r--r--JCL/converterJclMin19/src/java/lang/ReflectiveOperationException.java26
-rw-r--r--JCL/converterJclMin19/src/java/lang/RuntimeException.java12
-rw-r--r--JCL/converterJclMin19/src/java/lang/String.java8
-rw-r--r--JCL/converterJclMin19/src/java/lang/System.java20
-rw-r--r--JCL/converterJclMin19/src/java/lang/Throwable.java20
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/Annotation.java4
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/Documented.java12
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/ElementType.java48
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/Inherited.java13
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/Retention.java14
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/RetentionPolicy.java6
-rw-r--r--JCL/converterJclMin19/src/java/lang/annotation/Target.java14
-rw-r--r--JCL/converterJclMin19/src/java/lang/invoke/MethodHandle.java39
-rw-r--r--JCL/converterJclMin19/src/java/lang/invoke/MethodHandles.java22
-rw-r--r--JCL/converterJclMin19/src/java/lang/invoke/MethodType.java17
-rw-r--r--JCL/converterJclMin19/src/java/lang/invoke/TypeDescriptor.java31
-rw-r--r--JCL/converterJclMin19/src/java/lang/runtime/ObjectMethods.java14
-rw-r--r--JCL/converterJclMin19/src/java/lang/runtime/SwitchBootstraps.java30
-rw-r--r--JCL/converterJclMin19/src/java/util/Collection.java9
-rw-r--r--JCL/converterJclMin19/src/java/util/Iterator.java7
-rw-r--r--JCL/converterJclMin19/src/java/util/List.java4
-rw-r--r--JCL/converterJclMin19/src/java/util/Map.java5
-rw-r--r--JCL/converterJclMin19/src/java/util/function/Consumer.java10
-rw-r--r--JCL/converterJclMin19/src/javax/lang/model/SourceVersion.java71
-rw-r--r--JCL/converterJclMin19/src/module-info.java7
-rw-r--r--features/org.eclipse.objectteams.otdt.core.patch/feature.xml2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/pom.xml54
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java12
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest9.java2
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java28
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java3
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java12
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java78
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java91
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofPrimaryPatternTest.java24
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests18.java91
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java56
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java168
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java53
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java1667
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java33
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java67
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java247
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java29
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedModuleTest.java142
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java23
-rw-r--r--org.eclipse.jdt.core.tests.compiler/workspace/ignore-unnamed-module-test.jarbin0 -> 2896 bytes
-rw-r--r--org.eclipse.jdt.core.tests.compiler/workspace/lib576735.jarbin0 -> 4598 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/build.xml16
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jarbin41037 -> 51399 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jarbin41864 -> 52449 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jarbin12516 -> 14773 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jarbin12578 -> 14824 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jarbin12575 -> 14820 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jarbin18383 -> 22436 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jarbin19833 -> 23924 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jarbin19843 -> 24388 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zipbin16573 -> 15887 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin17.jarbin20953 -> 1786 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin17src.zipbin19051 -> 772 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin18.jarbin0 -> 21030 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin18src.zipbin0 -> 19060 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin19.jarbin0 -> 21057 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin19src.zipbin0 -> 19062 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jarbin12791 -> 15075 bytes
-rw-r--r--org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jdt.core.tests.model/pom.xml54
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava19Tests.java80
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS4Test.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS8Test.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST8_2.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_GuardedPattern_Test.java141
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_PreviewTest.java25
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_RecordPattern_Test.java593
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java5
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java6
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java6
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java12
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java3
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java33
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java7
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java15
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java58
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests19.java465
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java2
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java40
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs19Tests.java781
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java89
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java212
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleOptionsTests.java4
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java44
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordPatternTest.java586
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchPatternTest.java26
-rw-r--r--org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java15
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_19/.classpath6
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_19/.project17
-rw-r--r--org.eclipse.jdt.core.tests.model/workspace/Converter_19/src/X.java4
-rw-r--r--org.eclipse.jdt.core/.settings/.api_filters35
-rw-r--r--org.eclipse.jdt.core/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java5
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties9
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java9
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java2
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java3
-rw-r--r--org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java44
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java27
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java3
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java29
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java8
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java12
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java12
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/GuardedPattern.java47
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java103
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Pattern.java45
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordPattern.java279
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java39
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypePattern.java134
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java19
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java7
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java2
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java9
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java24
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java10
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties1
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java1528
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java26
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java113
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java49
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rscbin43172 -> 43052 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rscbin818 -> 826 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rscbin818 -> 826 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rscbin818 -> 826 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rscbin818 -> 826 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rscbin3188 -> 3218 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rscbin2026 -> 2046 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rscbin2986 -> 2994 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rscbin2232 -> 2246 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rscbin19292 -> 19720 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rscbin818 -> 826 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rscbin40940 -> 40806 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rscbin21958 -> 22108 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rscbin8928 -> 8984 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rscbin1018 -> 1024 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rscbin100 -> 100 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rscbin1018 -> 1024 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rscbin2986 -> 2994 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rscbin4854 -> 4924 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rscbin2986 -> 2994 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rscbin2008 -> 2042 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rscbin310 -> 312 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rscbin1018 -> 1024 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rscbin19152 -> 19560 bytes
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props11
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java76
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties14
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java1
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java39
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java32
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java26
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java28
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java32
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java9
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java49
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java15
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullPattern.java7
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Pattern.java15
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java322
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypePattern.java13
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java50
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java15
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java48
-rw-r--r--org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java3
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java4
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java2
-rw-r--r--org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java33
-rw-r--r--org.eclipse.jdt.core/grammar/java.g90
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java28
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java6
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java3
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java13
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java9
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java12
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java3
-rw-r--r--org.eclipse.jdt.core/pom.xml4
-rw-r--r--org.eclipse.jdt.core/scripts/.gitignore2
-rw-r--r--org.eclipse.jdt.core/scripts/binary/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java2
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java22
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java9
-rw-r--r--org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java73
-rw-r--r--plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF2
-rw-r--r--releng/map/otdt.map.in2
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutParameterBinding_LiftingAndLowering.java1
-rw-r--r--testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/regression/ReportedBugs.java4
305 files changed, 10343 insertions, 1531 deletions
diff --git a/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java
index 557ab1811..cea98496d 100644
--- a/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java
+++ b/JCL/converterJclMin15/src/javax/lang/model/SourceVersion.java
@@ -28,16 +28,17 @@ public enum SourceVersion {
RELEASE_12,
RELEASE_13,
- RELEASE_14;
+ RELEASE_14,
+ RELEASE_15;
public static SourceVersion latest() {
- return RELEASE_14;
+ return RELEASE_15;
}
private static final SourceVersion latestSupported = getLatestSupported();
private static SourceVersion getLatestSupported() {
- return RELEASE_14;
+ return RELEASE_15;
}
public static SourceVersion latestSupported() {
diff --git a/JCL/converterJclMin17/.project b/JCL/converterJclMin17/.project
new file mode 100644
index 000000000..d14b1b5b1
--- /dev/null
+++ b/JCL/converterJclMin17/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin17</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin17/.settings/org.eclipse.core.resources.prefs b/JCL/converterJclMin17/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/JCL/converterJclMin17/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/JCL/converterJclMin17/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin17/src/javax/lang/model/SourceVersion.java
new file mode 100644
index 000000000..17ae84276
--- /dev/null
+++ b/JCL/converterJclMin17/src/javax/lang/model/SourceVersion.java
@@ -0,0 +1,69 @@
+package javax.lang.model;
+
+public enum SourceVersion {
+
+ RELEASE_0,
+
+ RELEASE_1,
+
+ RELEASE_2,
+
+ RELEASE_3,
+
+ RELEASE_4,
+
+ RELEASE_5,
+
+ RELEASE_6,
+
+ RELEASE_7,
+
+ RELEASE_8,
+ RELEASE_9,
+
+ RELEASE_10,
+
+ RELEASE_11,
+
+ RELEASE_12,
+
+ RELEASE_13,
+ RELEASE_14,
+ RELEASE_15,
+ RELEASE_16,
+ RELEASE_17;
+
+ public static SourceVersion latest() {
+ return RELEASE_17;
+ }
+
+ private static final SourceVersion latestSupported = getLatestSupported();
+
+ private static SourceVersion getLatestSupported() {
+ return RELEASE_17;
+ }
+
+ public static SourceVersion latestSupported() {
+ return latestSupported;
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ return true;
+ }
+
+ public static boolean isName(CharSequence name) {
+ return isName(name, latest());
+ }
+
+ public static boolean isName(CharSequence name, SourceVersion version) {
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return isKeyword(s, latest());
+ }
+
+ public static boolean isKeyword(CharSequence s, SourceVersion version) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin18/.project b/JCL/converterJclMin18/.project
new file mode 100644
index 000000000..2688e1f52
--- /dev/null
+++ b/JCL/converterJclMin18/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin18</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin18/.settings/org.eclipse.core.resources.prefs b/JCL/converterJclMin18/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/JCL/converterJclMin18/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/JCL/converterJclMin18/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin18/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..223b16672
--- /dev/null
+++ b/JCL/converterJclMin18/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,14 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=15
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=15
diff --git a/JCL/converterJclMin18/src/META-INF/MANIFEST.MF b/JCL/converterJclMin18/src/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..c72a1fbae
--- /dev/null
+++ b/JCL/converterJclMin18/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 1.8.0_151 (Oracle Corporation)
+
diff --git a/JCL/converterJclMin18/src/java/io/InputStream.java b/JCL/converterJclMin18/src/java/io/InputStream.java
new file mode 100644
index 000000000..82511babe
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/io/InputStream.java
@@ -0,0 +1,5 @@
+package java.io;
+
+public class InputStream {
+
+}
diff --git a/JCL/converterJclMin18/src/java/io/PrintStream.java b/JCL/converterJclMin18/src/java/io/PrintStream.java
new file mode 100644
index 000000000..19059381a
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/io/PrintStream.java
@@ -0,0 +1,8 @@
+package java.io;
+
+public class PrintStream {
+ public void println(String x) {
+ }
+ public void println(int x) {
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/io/Serializable.java b/JCL/converterJclMin18/src/java/io/Serializable.java
new file mode 100644
index 000000000..edd882d7d
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/CharSequence.java b/JCL/converterJclMin18/src/java/lang/CharSequence.java
new file mode 100644
index 000000000..b9a0d9e41
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Class.java b/JCL/converterJclMin18/src/java/lang/Class.java
new file mode 100644
index 000000000..a7667b983
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin18/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 000000000..7765ed820
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class ClassNotFoundException extends ReflectiveOperationException {
+
+ public ClassNotFoundException() {
+ super((Throwable)null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s) {
+ super(s, null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s, Throwable ex) {
+ super(s, ex); // Disallow initCause
+ }
+
+ public Throwable getException() {
+ return getCause();
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin18/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 000000000..cb777dc7b
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Comparable.java b/JCL/converterJclMin18/src/java/lang/Comparable.java
new file mode 100644
index 000000000..fbc6c8bac
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Deprecated.java b/JCL/converterJclMin18/src/java/lang/Deprecated.java
new file mode 100644
index 000000000..6c73dedd0
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/Enum.java b/JCL/converterJclMin18/src/java/lang/Enum.java
new file mode 100644
index 000000000..a510103e6
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Enum.java
@@ -0,0 +1,18 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+ public static <T extends Enum<T>> T valueOf(Class<T> enumClass,
+ String name) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Error.java b/JCL/converterJclMin18/src/java/lang/Error.java
new file mode 100644
index 000000000..9a446d532
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Error.java
@@ -0,0 +1,16 @@
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error(java.lang.String s, java.lang.Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Exception.java b/JCL/converterJclMin18/src/java/lang/Exception.java
new file mode 100644
index 000000000..0adef36ba
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ super();
+ }
+
+ public Exception(String message) {
+ super(message);
+ }
+
+ public Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Exception(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin18/src/java/lang/IllegalAccessException.java
new file mode 100644
index 000000000..814649067
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin18/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin18/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 000000000..e173f133a
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/IncompatibleClassChangeError.java b/JCL/converterJclMin18/src/java/lang/IncompatibleClassChangeError.java
new file mode 100644
index 000000000..9552b875b
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/IncompatibleClassChangeError.java
@@ -0,0 +1,13 @@
+
+package java.lang;
+public
+class IncompatibleClassChangeError extends LinkageError {
+
+ public IncompatibleClassChangeError () {
+ super();
+ }
+
+ public IncompatibleClassChangeError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Integer.java b/JCL/converterJclMin18/src/java/lang/Integer.java
new file mode 100644
index 000000000..f9b9e0b6e
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Integer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Integer extends Number implements Comparable<Integer> {
+ private static final long serialVersionUID = 6462609062775655000L;
+
+ public Integer(int i) {
+ }
+ public Integer(String s) {
+ }
+ public static final int MAX_VALUE= 2147483647;
+ public static final int MIN_VALUE= -2147483647;
+
+ public static int parseInt(String s) {
+ return 0;
+ }
+ public static String toHexString(int i) {
+ return null;
+ }
+ public static String toString(int i) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Integer i) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/InterruptedException.java b/JCL/converterJclMin18/src/java/lang/InterruptedException.java
new file mode 100644
index 000000000..e2e84ba0b
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Iterable.java b/JCL/converterJclMin18/src/java/lang/Iterable.java
new file mode 100644
index 000000000..ab4b9d53f
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Iterable.java
@@ -0,0 +1,10 @@
+package java.lang;
+
+import java.util.Iterator;
+import java.util.function.Consumer;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+ default void forEach(Consumer<? super T> action) {
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/LinkageError.java b/JCL/converterJclMin18/src/java/lang/LinkageError.java
new file mode 100644
index 000000000..199d39d98
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/LinkageError.java
@@ -0,0 +1,17 @@
+package java.lang;
+
+public
+class LinkageError extends Error {
+
+ public LinkageError() {
+ super();
+ }
+
+ public LinkageError(String s) {
+ super(s);
+ }
+
+ public LinkageError(String s, Throwable cause) {
+ super(s, cause);
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/NoClassDefFoundError.java b/JCL/converterJclMin18/src/java/lang/NoClassDefFoundError.java
new file mode 100644
index 000000000..da0fe415c
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/NoClassDefFoundError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoClassDefFoundError extends LinkageError {
+
+ public NoClassDefFoundError() {
+ super();
+ }
+
+ public NoClassDefFoundError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin18/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 000000000..486e5339d
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoSuchFieldError extends IncompatibleClassChangeError {
+
+ public NoSuchFieldError() {
+ super();
+ }
+
+ public NoSuchFieldError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin18/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 000000000..b8c5bce7a
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin18/src/java/lang/NullPointerException.java b/JCL/converterJclMin18/src/java/lang/NullPointerException.java
new file mode 100644
index 000000000..5e4ffa680
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/NullPointerException.java
@@ -0,0 +1,11 @@
+package java.lang;
+public
+class NullPointerException extends RuntimeException {
+ public NullPointerException() {
+ super();
+ }
+
+ public NullPointerException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/Number.java b/JCL/converterJclMin18/src/java/lang/Number.java
new file mode 100644
index 000000000..db90345a8
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Number.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+public abstract class Number implements java.io.Serializable {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Object.java b/JCL/converterJclMin18/src/java/lang/Object.java
new file mode 100644
index 000000000..eb50899e5
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Override.java b/JCL/converterJclMin18/src/java/lang/Override.java
new file mode 100644
index 000000000..b94fa6e86
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Override.java
@@ -0,0 +1,7 @@
+package java.lang;
+
+import java.lang.annotation.*;
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Record.java b/JCL/converterJclMin18/src/java/lang/Record.java
new file mode 100644
index 000000000..c9913367b
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Record.java
@@ -0,0 +1,9 @@
+package java.lang;
+public abstract class Record {
+ @Override
+ public abstract boolean equals(Object obj);
+ @Override
+ public abstract int hashCode();
+ @Override
+ public abstract String toString();
+}
diff --git a/JCL/converterJclMin18/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin18/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 000000000..0860c6790
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,26 @@
+
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+
+ public ReflectiveOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ReflectiveOperationException(Throwable cause) {
+ super(cause);
+ }
+
+ public java.lang.Throwable getCause() {
+ return getCause();
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/RuntimeException.java b/JCL/converterJclMin18/src/java/lang/RuntimeException.java
new file mode 100644
index 000000000..80dc1dbd3
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/RuntimeException.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+
+ public RuntimeException(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public RuntimeException() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/String.java b/JCL/converterJclMin18/src/java/lang/String.java
new file mode 100644
index 000000000..ba6bf08bf
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/String.java
@@ -0,0 +1,8 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+ public int codePointAt(int index) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/System.java b/JCL/converterJclMin18/src/java/lang/System.java
new file mode 100644
index 000000000..bf56c93aa
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/System.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+public final class System {
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ private System() {
+ }
+
+ public static final InputStream in = null;
+
+ public static final PrintStream out = null;
+
+
+}
diff --git a/JCL/converterJclMin18/src/java/lang/Throwable.java b/JCL/converterJclMin18/src/java/lang/Throwable.java
new file mode 100644
index 000000000..2488269be
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/Throwable.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class Throwable {
+
+ public Throwable(java.lang.String message) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(java.lang.String message, Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin18/src/java/lang/annotation/Annotation.java
new file mode 100644
index 000000000..ba72aad15
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/Documented.java b/JCL/converterJclMin18/src/java/lang/annotation/Documented.java
new file mode 100644
index 000000000..34494fb5f
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/Documented.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin18/src/java/lang/annotation/ElementType.java
new file mode 100644
index 000000000..7b5b59578
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,48 @@
+package java.lang.annotation;
+
+public enum ElementType {
+ /** Class, interface (including annotation type), or enum declaration */
+ TYPE,
+
+ /** Field declaration (includes enum constants) */
+ FIELD,
+
+ /** Method declaration */
+ METHOD,
+
+ /** Formal parameter declaration */
+ PARAMETER,
+
+ /** Constructor declaration */
+ CONSTRUCTOR,
+
+ /** Local variable declaration */
+ LOCAL_VARIABLE,
+
+ /** Annotation type declaration */
+ ANNOTATION_TYPE,
+
+ /** Package declaration */
+ PACKAGE,
+
+ /**
+ * Type parameter declaration
+ *
+ * @since 1.8
+ */
+ TYPE_PARAMETER,
+
+ /**
+ * Use of a type
+ *
+ * @since 1.8
+ */
+ TYPE_USE,
+
+ /**
+ * Module declaration.
+ *
+ * @since 9
+ */
+ MODULE
+}
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin18/src/java/lang/annotation/Inherited.java
new file mode 100644
index 000000000..9753e0c41
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/Retention.java b/JCL/converterJclMin18/src/java/lang/annotation/Retention.java
new file mode 100644
index 000000000..72f141758
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/Retention.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin18/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 000000000..b69fa7d65
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/annotation/Target.java b/JCL/converterJclMin18/src/java/lang/annotation/Target.java
new file mode 100644
index 000000000..239f6b1ee
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/annotation/Target.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin18/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 000000000..789476586
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,39 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.invoke.MethodType;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin18/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 000000000..49d9f1f87
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,22 @@
+package java.lang.invoke;
+import java.lang.invoke.MethodType;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin18/src/java/lang/invoke/MethodType.java
new file mode 100644
index 000000000..802a3f2c8
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/invoke/TypeDescriptor.java b/JCL/converterJclMin18/src/java/lang/invoke/TypeDescriptor.java
new file mode 100644
index 000000000..a5e158d15
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/invoke/TypeDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.lang.invoke;
+
+import java.util.List;
+
+public interface TypeDescriptor {
+ String descriptorString();
+}
diff --git a/JCL/converterJclMin18/src/java/lang/runtime/ObjectMethods.java b/JCL/converterJclMin18/src/java/lang/runtime/ObjectMethods.java
new file mode 100644
index 000000000..7587fef8f
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/runtime/ObjectMethods.java
@@ -0,0 +1,14 @@
+package java.lang.runtime;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.TypeDescriptor;
+
+public class ObjectMethods {
+ public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
+ Class<?> recordClass,
+ String names,
+ MethodHandle... getters) throws Throwable {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin18/src/java/lang/runtime/SwitchBootstraps.java b/JCL/converterJclMin18/src/java/lang/runtime/SwitchBootstraps.java
new file mode 100644
index 000000000..92896069a
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/lang/runtime/SwitchBootstraps.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.runtime;
+
+public class SwitchBootstraps {
+}
+
diff --git a/JCL/converterJclMin18/src/java/util/Collection.java b/JCL/converterJclMin18/src/java/util/Collection.java
new file mode 100644
index 000000000..a40b2d29a
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin18/src/java/util/Iterator.java b/JCL/converterJclMin18/src/java/util/Iterator.java
new file mode 100644
index 000000000..f90ee762c
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin18/src/java/util/List.java b/JCL/converterJclMin18/src/java/util/List.java
new file mode 100644
index 000000000..7d19bdfb1
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin18/src/java/util/Map.java b/JCL/converterJclMin18/src/java/util/Map.java
new file mode 100644
index 000000000..574a7f816
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin18/src/java/util/function/Consumer.java b/JCL/converterJclMin18/src/java/util/function/Consumer.java
new file mode 100644
index 000000000..dd5b3f408
--- /dev/null
+++ b/JCL/converterJclMin18/src/java/util/function/Consumer.java
@@ -0,0 +1,10 @@
+package java.util.function;
+
+public interface Consumer<T> {
+
+ void accept(T t);
+
+ default Consumer<T> andThen(Consumer<? super T> after) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin18/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin18/src/javax/lang/model/SourceVersion.java
new file mode 100644
index 000000000..906a2d141
--- /dev/null
+++ b/JCL/converterJclMin18/src/javax/lang/model/SourceVersion.java
@@ -0,0 +1,70 @@
+package javax.lang.model;
+
+public enum SourceVersion {
+
+ RELEASE_0,
+
+ RELEASE_1,
+
+ RELEASE_2,
+
+ RELEASE_3,
+
+ RELEASE_4,
+
+ RELEASE_5,
+
+ RELEASE_6,
+
+ RELEASE_7,
+
+ RELEASE_8,
+ RELEASE_9,
+
+ RELEASE_10,
+
+ RELEASE_11,
+
+ RELEASE_12,
+
+ RELEASE_13,
+ RELEASE_14,
+ RELEASE_15,
+ RELEASE_16,
+ RELEASE_17,
+ RELEASE_18;
+
+ public static SourceVersion latest() {
+ return RELEASE_18;
+ }
+
+ private static final SourceVersion latestSupported = getLatestSupported();
+
+ private static SourceVersion getLatestSupported() {
+ return RELEASE_18;
+ }
+
+ public static SourceVersion latestSupported() {
+ return latestSupported;
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ return true;
+ }
+
+ public static boolean isName(CharSequence name) {
+ return isName(name, latest());
+ }
+
+ public static boolean isName(CharSequence name, SourceVersion version) {
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return isKeyword(s, latest());
+ }
+
+ public static boolean isKeyword(CharSequence s, SourceVersion version) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin18/src/module-info.java b/JCL/converterJclMin18/src/module-info.java
new file mode 100644
index 000000000..51a23b131
--- /dev/null
+++ b/JCL/converterJclMin18/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/.project b/JCL/converterJclMin19/.project
new file mode 100644
index 000000000..7e45b414f
--- /dev/null
+++ b/JCL/converterJclMin19/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>converterJclMin19</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/JCL/converterJclMin19/.settings/org.eclipse.core.resources.prefs b/JCL/converterJclMin19/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..99f26c020
--- /dev/null
+++ b/JCL/converterJclMin19/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/JCL/converterJclMin19/.settings/org.eclipse.jdt.core.prefs b/JCL/converterJclMin19/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..223b16672
--- /dev/null
+++ b/JCL/converterJclMin19/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,14 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=15
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=15
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=enabled
+org.eclipse.jdt.core.compiler.source=15
diff --git a/JCL/converterJclMin19/src/META-INF/MANIFEST.MF b/JCL/converterJclMin19/src/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..c72a1fbae
--- /dev/null
+++ b/JCL/converterJclMin19/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Created-By: 1.8.0_151 (Oracle Corporation)
+
diff --git a/JCL/converterJclMin19/src/java/io/InputStream.java b/JCL/converterJclMin19/src/java/io/InputStream.java
new file mode 100644
index 000000000..82511babe
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/io/InputStream.java
@@ -0,0 +1,5 @@
+package java.io;
+
+public class InputStream {
+
+}
diff --git a/JCL/converterJclMin19/src/java/io/PrintStream.java b/JCL/converterJclMin19/src/java/io/PrintStream.java
new file mode 100644
index 000000000..19059381a
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/io/PrintStream.java
@@ -0,0 +1,8 @@
+package java.io;
+
+public class PrintStream {
+ public void println(String x) {
+ }
+ public void println(int x) {
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/io/Serializable.java b/JCL/converterJclMin19/src/java/io/Serializable.java
new file mode 100644
index 000000000..edd882d7d
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/io/Serializable.java
@@ -0,0 +1,4 @@
+package java.io;
+
+public interface Serializable {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/CharSequence.java b/JCL/converterJclMin19/src/java/lang/CharSequence.java
new file mode 100644
index 000000000..b9a0d9e41
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/CharSequence.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public interface CharSequence {
+ int length();
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Class.java b/JCL/converterJclMin19/src/java/lang/Class.java
new file mode 100644
index 000000000..a7667b983
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Class.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class Class<T> {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/ClassNotFoundException.java b/JCL/converterJclMin19/src/java/lang/ClassNotFoundException.java
new file mode 100644
index 000000000..7765ed820
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/ClassNotFoundException.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class ClassNotFoundException extends ReflectiveOperationException {
+
+ public ClassNotFoundException() {
+ super((Throwable)null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s) {
+ super(s, null); // Disallow initCause
+ }
+
+ public ClassNotFoundException(String s, Throwable ex) {
+ super(s, ex); // Disallow initCause
+ }
+
+ public Throwable getException() {
+ return getCause();
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/CloneNotSupportedException.java b/JCL/converterJclMin19/src/java/lang/CloneNotSupportedException.java
new file mode 100644
index 000000000..cb777dc7b
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/CloneNotSupportedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class CloneNotSupportedException extends Exception {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Comparable.java b/JCL/converterJclMin19/src/java/lang/Comparable.java
new file mode 100644
index 000000000..fbc6c8bac
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Comparable.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public interface Comparable<T> {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Deprecated.java b/JCL/converterJclMin19/src/java/lang/Deprecated.java
new file mode 100644
index 000000000..6c73dedd0
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Deprecated.java
@@ -0,0 +1,6 @@
+package java.lang;
+import java.lang.annotation.*;
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Deprecated {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/Enum.java b/JCL/converterJclMin19/src/java/lang/Enum.java
new file mode 100644
index 000000000..a510103e6
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Enum.java
@@ -0,0 +1,18 @@
+package java.lang;
+
+public abstract class Enum<T extends Enum<T>> implements Comparable<T>, java.io.Serializable {
+ private static final long serialVersionUID = 2L;
+
+ protected Enum(String name, int ordinal) {
+ }
+ public final String name() {
+ return null;
+ }
+ public final int ordinal() {
+ return 0;
+ }
+ public static <T extends Enum<T>> T valueOf(Class<T> enumClass,
+ String name) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Error.java b/JCL/converterJclMin19/src/java/lang/Error.java
new file mode 100644
index 000000000..9a446d532
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Error.java
@@ -0,0 +1,16 @@
+package java.lang;
+
+public class Error extends Throwable {
+
+ public Error(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error(java.lang.String s, java.lang.Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Error() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Exception.java b/JCL/converterJclMin19/src/java/lang/Exception.java
new file mode 100644
index 000000000..0adef36ba
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Exception.java
@@ -0,0 +1,19 @@
+package java.lang;
+
+public class Exception extends Throwable {
+ public Exception() {
+ super();
+ }
+
+ public Exception(String message) {
+ super(message);
+ }
+
+ public Exception(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public Exception(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/IllegalAccessException.java b/JCL/converterJclMin19/src/java/lang/IllegalAccessException.java
new file mode 100644
index 000000000..814649067
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/IllegalAccessException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class IllegalAccessException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin19/src/java/lang/IllegalMonitorStateException.java b/JCL/converterJclMin19/src/java/lang/IllegalMonitorStateException.java
new file mode 100644
index 000000000..e173f133a
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/IllegalMonitorStateException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class IllegalMonitorStateException extends RuntimeException {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/IncompatibleClassChangeError.java b/JCL/converterJclMin19/src/java/lang/IncompatibleClassChangeError.java
new file mode 100644
index 000000000..9552b875b
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/IncompatibleClassChangeError.java
@@ -0,0 +1,13 @@
+
+package java.lang;
+public
+class IncompatibleClassChangeError extends LinkageError {
+
+ public IncompatibleClassChangeError () {
+ super();
+ }
+
+ public IncompatibleClassChangeError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Integer.java b/JCL/converterJclMin19/src/java/lang/Integer.java
new file mode 100644
index 000000000..f9b9e0b6e
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Integer.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package java.lang;
+
+public class Integer extends Number implements Comparable<Integer> {
+ private static final long serialVersionUID = 6462609062775655000L;
+
+ public Integer(int i) {
+ }
+ public Integer(String s) {
+ }
+ public static final int MAX_VALUE= 2147483647;
+ public static final int MIN_VALUE= -2147483647;
+
+ public static int parseInt(String s) {
+ return 0;
+ }
+ public static String toHexString(int i) {
+ return null;
+ }
+ public static String toString(int i) {
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#doubleValue()
+ */
+ public double doubleValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#floatValue()
+ */
+ public float floatValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#intValue()
+ */
+ public int intValue() {
+ return 0;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Number#longValue()
+ */
+ public long longValue() {
+ return 0;
+ }
+ public int compareTo(Integer i) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/InterruptedException.java b/JCL/converterJclMin19/src/java/lang/InterruptedException.java
new file mode 100644
index 000000000..e2e84ba0b
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/InterruptedException.java
@@ -0,0 +1,4 @@
+package java.lang;
+
+public class InterruptedException extends Exception {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Iterable.java b/JCL/converterJclMin19/src/java/lang/Iterable.java
new file mode 100644
index 000000000..ab4b9d53f
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Iterable.java
@@ -0,0 +1,10 @@
+package java.lang;
+
+import java.util.Iterator;
+import java.util.function.Consumer;
+
+public interface Iterable<T> {
+ Iterator<T> iterator();
+ default void forEach(Consumer<? super T> action) {
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/LinkageError.java b/JCL/converterJclMin19/src/java/lang/LinkageError.java
new file mode 100644
index 000000000..199d39d98
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/LinkageError.java
@@ -0,0 +1,17 @@
+package java.lang;
+
+public
+class LinkageError extends Error {
+
+ public LinkageError() {
+ super();
+ }
+
+ public LinkageError(String s) {
+ super(s);
+ }
+
+ public LinkageError(String s, Throwable cause) {
+ super(s, cause);
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/NoClassDefFoundError.java b/JCL/converterJclMin19/src/java/lang/NoClassDefFoundError.java
new file mode 100644
index 000000000..da0fe415c
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/NoClassDefFoundError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoClassDefFoundError extends LinkageError {
+
+ public NoClassDefFoundError() {
+ super();
+ }
+
+ public NoClassDefFoundError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/NoSuchFieldError.java b/JCL/converterJclMin19/src/java/lang/NoSuchFieldError.java
new file mode 100644
index 000000000..486e5339d
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/NoSuchFieldError.java
@@ -0,0 +1,13 @@
+package java.lang;
+
+public
+class NoSuchFieldError extends IncompatibleClassChangeError {
+
+ public NoSuchFieldError() {
+ super();
+ }
+
+ public NoSuchFieldError(String s) {
+ super(s);
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/NoSuchMethodException.java b/JCL/converterJclMin19/src/java/lang/NoSuchMethodException.java
new file mode 100644
index 000000000..b8c5bce7a
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/NoSuchMethodException.java
@@ -0,0 +1,5 @@
+package java.lang;
+
+public class NoSuchMethodException extends RuntimeException {
+
+}
diff --git a/JCL/converterJclMin19/src/java/lang/NullPointerException.java b/JCL/converterJclMin19/src/java/lang/NullPointerException.java
new file mode 100644
index 000000000..5e4ffa680
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/NullPointerException.java
@@ -0,0 +1,11 @@
+package java.lang;
+public
+class NullPointerException extends RuntimeException {
+ public NullPointerException() {
+ super();
+ }
+
+ public NullPointerException(String s) {
+ super(s);
+ }
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/Number.java b/JCL/converterJclMin19/src/java/lang/Number.java
new file mode 100644
index 000000000..db90345a8
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Number.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+public abstract class Number implements java.io.Serializable {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Object.java b/JCL/converterJclMin19/src/java/lang/Object.java
new file mode 100644
index 000000000..eb50899e5
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Object.java
@@ -0,0 +1,34 @@
+package java.lang;
+
+public class Object {
+
+public Object() {
+}
+protected Object clone() throws CloneNotSupportedException {
+ return null;
+}
+public boolean equals (Object obj) {
+ return false;
+}
+protected void finalize () throws Throwable {
+}
+public final Class<? extends Object> getClass() {
+ return null;
+}
+public int hashCode() {
+ return -1;
+}
+public final void notify() throws IllegalMonitorStateException {
+}
+public final void notifyAll() throws IllegalMonitorStateException {
+}
+public String toString () {
+ return null;
+}
+public final void wait () throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis) throws IllegalMonitorStateException, InterruptedException {
+}
+public final void wait (long millis, int nanos) throws IllegalMonitorStateException, InterruptedException {
+}
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Override.java b/JCL/converterJclMin19/src/java/lang/Override.java
new file mode 100644
index 000000000..b94fa6e86
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Override.java
@@ -0,0 +1,7 @@
+package java.lang;
+
+import java.lang.annotation.*;
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.SOURCE)
+public @interface Override {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Record.java b/JCL/converterJclMin19/src/java/lang/Record.java
new file mode 100644
index 000000000..c9913367b
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Record.java
@@ -0,0 +1,9 @@
+package java.lang;
+public abstract class Record {
+ @Override
+ public abstract boolean equals(Object obj);
+ @Override
+ public abstract int hashCode();
+ @Override
+ public abstract String toString();
+}
diff --git a/JCL/converterJclMin19/src/java/lang/ReflectiveOperationException.java b/JCL/converterJclMin19/src/java/lang/ReflectiveOperationException.java
new file mode 100644
index 000000000..0860c6790
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/ReflectiveOperationException.java
@@ -0,0 +1,26 @@
+
+package java.lang;
+
+public class ReflectiveOperationException extends Exception {
+ static final long serialVersionUID = 123456789L;
+
+ public ReflectiveOperationException() {
+ super();
+ }
+
+ public ReflectiveOperationException(String message) {
+ super(message);
+ }
+
+ public ReflectiveOperationException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ReflectiveOperationException(Throwable cause) {
+ super(cause);
+ }
+
+ public java.lang.Throwable getCause() {
+ return getCause();
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/RuntimeException.java b/JCL/converterJclMin19/src/java/lang/RuntimeException.java
new file mode 100644
index 000000000..80dc1dbd3
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/RuntimeException.java
@@ -0,0 +1,12 @@
+package java.lang;
+
+public class RuntimeException extends Exception {
+
+ public RuntimeException(java.lang.String s) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public RuntimeException() {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/String.java b/JCL/converterJclMin19/src/java/lang/String.java
new file mode 100644
index 000000000..ba6bf08bf
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/String.java
@@ -0,0 +1,8 @@
+package java.lang;
+
+public class String implements CharSequence {
+ public int length() { return 0; }
+ public int codePointAt(int index) {
+ return 0;
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/System.java b/JCL/converterJclMin19/src/java/lang/System.java
new file mode 100644
index 000000000..bf56c93aa
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/System.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+public final class System {
+ private static native void registerNatives();
+ static {
+ registerNatives();
+ }
+
+ private System() {
+ }
+
+ public static final InputStream in = null;
+
+ public static final PrintStream out = null;
+
+
+}
diff --git a/JCL/converterJclMin19/src/java/lang/Throwable.java b/JCL/converterJclMin19/src/java/lang/Throwable.java
new file mode 100644
index 000000000..2488269be
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/Throwable.java
@@ -0,0 +1,20 @@
+package java.lang;
+
+public class Throwable {
+
+ public Throwable(java.lang.String message) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable() {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(java.lang.String message, Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+
+ public Throwable(Throwable cause) {
+ // TODO Auto-generated constructor stub
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/Annotation.java b/JCL/converterJclMin19/src/java/lang/annotation/Annotation.java
new file mode 100644
index 000000000..ba72aad15
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/Annotation.java
@@ -0,0 +1,4 @@
+package java.lang.annotation;
+public interface Annotation {
+
+}
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/Documented.java b/JCL/converterJclMin19/src/java/lang/annotation/Documented.java
new file mode 100644
index 000000000..34494fb5f
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/Documented.java
@@ -0,0 +1,12 @@
+package java.lang.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Documented {
+}
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/ElementType.java b/JCL/converterJclMin19/src/java/lang/annotation/ElementType.java
new file mode 100644
index 000000000..7b5b59578
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/ElementType.java
@@ -0,0 +1,48 @@
+package java.lang.annotation;
+
+public enum ElementType {
+ /** Class, interface (including annotation type), or enum declaration */
+ TYPE,
+
+ /** Field declaration (includes enum constants) */
+ FIELD,
+
+ /** Method declaration */
+ METHOD,
+
+ /** Formal parameter declaration */
+ PARAMETER,
+
+ /** Constructor declaration */
+ CONSTRUCTOR,
+
+ /** Local variable declaration */
+ LOCAL_VARIABLE,
+
+ /** Annotation type declaration */
+ ANNOTATION_TYPE,
+
+ /** Package declaration */
+ PACKAGE,
+
+ /**
+ * Type parameter declaration
+ *
+ * @since 1.8
+ */
+ TYPE_PARAMETER,
+
+ /**
+ * Use of a type
+ *
+ * @since 1.8
+ */
+ TYPE_USE,
+
+ /**
+ * Module declaration.
+ *
+ * @since 9
+ */
+ MODULE
+}
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/Inherited.java b/JCL/converterJclMin19/src/java/lang/annotation/Inherited.java
new file mode 100644
index 000000000..9753e0c41
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/Inherited.java
@@ -0,0 +1,13 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Inherited {
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/Retention.java b/JCL/converterJclMin19/src/java/lang/annotation/Retention.java
new file mode 100644
index 000000000..72f141758
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/Retention.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Retention {
+ RetentionPolicy value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/RetentionPolicy.java b/JCL/converterJclMin19/src/java/lang/annotation/RetentionPolicy.java
new file mode 100644
index 000000000..b69fa7d65
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/RetentionPolicy.java
@@ -0,0 +1,6 @@
+package java.lang.annotation;
+public enum RetentionPolicy {
+ CLASS,
+ SOURCE,
+ RUNTIME
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/annotation/Target.java b/JCL/converterJclMin19/src/java/lang/annotation/Target.java
new file mode 100644
index 000000000..239f6b1ee
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/annotation/Target.java
@@ -0,0 +1,14 @@
+package java.lang.annotation;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.ANNOTATION_TYPE)
+public @interface Target {
+ ElementType[] value();
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/invoke/MethodHandle.java b/JCL/converterJclMin19/src/java/lang/invoke/MethodHandle.java
new file mode 100644
index 000000000..789476586
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/invoke/MethodHandle.java
@@ -0,0 +1,39 @@
+package java.lang.invoke;
+/*******************************************************************************
+ * Copyright (c) 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import java.lang.invoke.MethodType;
+
+public abstract class MethodHandle {
+ @Target(METHOD)
+ @Retention(RUNTIME)
+ @interface PolymorphicSignature {
+ }
+
+ @PolymorphicSignature
+ public final native Object invoke(Object... args) throws Throwable;
+
+ @PolymorphicSignature
+ public final native Object invokeExact(Object... args) throws Throwable;
+
+ public native Object invokeWithArguments(Object... arguments)
+ throws Throwable;
+
+ public native boolean isVarargsCollector();
+
+ public native MethodHandle asType(MethodType newType);
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/lang/invoke/MethodHandles.java b/JCL/converterJclMin19/src/java/lang/invoke/MethodHandles.java
new file mode 100644
index 000000000..49d9f1f87
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/invoke/MethodHandles.java
@@ -0,0 +1,22 @@
+package java.lang.invoke;
+import java.lang.invoke.MethodType;
+
+public class MethodHandles {
+ public static final class Lookup {
+ public MethodHandle findVirtual(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+
+ public MethodHandle findStatic(Class<?> refc, String name,
+ MethodType type) throws NoSuchMethodException,
+ IllegalAccessException {
+ return null;
+ }
+ }
+
+ public static Lookup lookup() {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/invoke/MethodType.java b/JCL/converterJclMin19/src/java/lang/invoke/MethodType.java
new file mode 100644
index 000000000..802a3f2c8
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/invoke/MethodType.java
@@ -0,0 +1,17 @@
+package java.lang.invoke;
+
+
+public final class MethodType {
+ public static MethodType methodType(Class<?> rtype, Class<?> ptype0,
+ Class<?>... ptypes) {
+ return null;
+ }
+
+ public static MethodType methodType(Class<?> rtype) {
+ return null;
+ }
+
+ public static MethodType genericMethodType(int objectArgCount) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/invoke/TypeDescriptor.java b/JCL/converterJclMin19/src/java/lang/invoke/TypeDescriptor.java
new file mode 100644
index 000000000..a5e158d15
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/invoke/TypeDescriptor.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.lang.invoke;
+
+import java.util.List;
+
+public interface TypeDescriptor {
+ String descriptorString();
+}
diff --git a/JCL/converterJclMin19/src/java/lang/runtime/ObjectMethods.java b/JCL/converterJclMin19/src/java/lang/runtime/ObjectMethods.java
new file mode 100644
index 000000000..7587fef8f
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/runtime/ObjectMethods.java
@@ -0,0 +1,14 @@
+package java.lang.runtime;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.TypeDescriptor;
+
+public class ObjectMethods {
+ public static Object bootstrap(MethodHandles.Lookup lookup, String methodName, TypeDescriptor type,
+ Class<?> recordClass,
+ String names,
+ MethodHandle... getters) throws Throwable {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin19/src/java/lang/runtime/SwitchBootstraps.java b/JCL/converterJclMin19/src/java/lang/runtime/SwitchBootstraps.java
new file mode 100644
index 000000000..92896069a
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/lang/runtime/SwitchBootstraps.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang.runtime;
+
+public class SwitchBootstraps {
+}
+
diff --git a/JCL/converterJclMin19/src/java/util/Collection.java b/JCL/converterJclMin19/src/java/util/Collection.java
new file mode 100644
index 000000000..a40b2d29a
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/util/Collection.java
@@ -0,0 +1,9 @@
+package java.util;
+
+public interface Collection<T> extends Iterable<T> {
+ public Iterator<T> iterator();
+ public int size();
+ public T get(int index);
+ public boolean addAll(Collection<T> c);
+ public T[] toArray(T[] o);
+}
diff --git a/JCL/converterJclMin19/src/java/util/Iterator.java b/JCL/converterJclMin19/src/java/util/Iterator.java
new file mode 100644
index 000000000..f90ee762c
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/util/Iterator.java
@@ -0,0 +1,7 @@
+package java.util;
+
+public interface Iterator<E> {
+ boolean hasNext();
+ E next();
+ void remove();
+}
diff --git a/JCL/converterJclMin19/src/java/util/List.java b/JCL/converterJclMin19/src/java/util/List.java
new file mode 100644
index 000000000..7d19bdfb1
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/util/List.java
@@ -0,0 +1,4 @@
+package java.util;
+
+public interface List<E> extends Collection<E> {
+}
diff --git a/JCL/converterJclMin19/src/java/util/Map.java b/JCL/converterJclMin19/src/java/util/Map.java
new file mode 100644
index 000000000..574a7f816
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/util/Map.java
@@ -0,0 +1,5 @@
+package java.util;
+
+public interface Map<K,V> {
+
+} \ No newline at end of file
diff --git a/JCL/converterJclMin19/src/java/util/function/Consumer.java b/JCL/converterJclMin19/src/java/util/function/Consumer.java
new file mode 100644
index 000000000..dd5b3f408
--- /dev/null
+++ b/JCL/converterJclMin19/src/java/util/function/Consumer.java
@@ -0,0 +1,10 @@
+package java.util.function;
+
+public interface Consumer<T> {
+
+ void accept(T t);
+
+ default Consumer<T> andThen(Consumer<? super T> after) {
+ return null;
+ }
+}
diff --git a/JCL/converterJclMin19/src/javax/lang/model/SourceVersion.java b/JCL/converterJclMin19/src/javax/lang/model/SourceVersion.java
new file mode 100644
index 000000000..9a02b685c
--- /dev/null
+++ b/JCL/converterJclMin19/src/javax/lang/model/SourceVersion.java
@@ -0,0 +1,71 @@
+package javax.lang.model;
+
+public enum SourceVersion {
+
+ RELEASE_0,
+
+ RELEASE_1,
+
+ RELEASE_2,
+
+ RELEASE_3,
+
+ RELEASE_4,
+
+ RELEASE_5,
+
+ RELEASE_6,
+
+ RELEASE_7,
+
+ RELEASE_8,
+ RELEASE_9,
+
+ RELEASE_10,
+
+ RELEASE_11,
+
+ RELEASE_12,
+
+ RELEASE_13,
+ RELEASE_14,
+ RELEASE_15,
+ RELEASE_16,
+ RELEASE_17,
+ RELEASE_18,
+ RELEASE_19;
+
+ public static SourceVersion latest() {
+ return RELEASE_19;
+ }
+
+ private static final SourceVersion latestSupported = getLatestSupported();
+
+ private static SourceVersion getLatestSupported() {
+ return RELEASE_19;
+ }
+
+ public static SourceVersion latestSupported() {
+ return latestSupported;
+ }
+
+ public static boolean isIdentifier(CharSequence name) {
+ return true;
+ }
+
+ public static boolean isName(CharSequence name) {
+ return isName(name, latest());
+ }
+
+ public static boolean isName(CharSequence name, SourceVersion version) {
+ return true;
+ }
+
+ public static boolean isKeyword(CharSequence s) {
+ return isKeyword(s, latest());
+ }
+
+ public static boolean isKeyword(CharSequence s, SourceVersion version) {
+ return true;
+ }
+}
diff --git a/JCL/converterJclMin19/src/module-info.java b/JCL/converterJclMin19/src/module-info.java
new file mode 100644
index 000000000..51a23b131
--- /dev/null
+++ b/JCL/converterJclMin19/src/module-info.java
@@ -0,0 +1,7 @@
+module java.base {
+ exports java.lang;
+ exports java.lang.annotation;
+ exports java.lang.invoke;
+ exports java.io;
+ exports java.util;
+} \ No newline at end of file
diff --git a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
index 673a0c3be..4a4d3765d 100644
--- a/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
+++ b/features/org.eclipse.objectteams.otdt.core.patch/feature.xml
@@ -66,7 +66,7 @@ Project Leader:
id="org.eclipse.jdt.core"
download-size="5614"
install-size="5614"
- version="3.31.0.OTDT_r282_qualifier"
+ version="3.32.0.OTDT_r282_qualifier"
unpack="false"/>
</feature>
diff --git a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
index baf441dbd..863424820 100644
--- a/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.compiler;singleton:=true
-Bundle-Version: 3.12.2000.qualifier
+Bundle-Version: 3.12.2050.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests.compiler,
diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml
index 7a5a8ce41..aff8d28ea 100644
--- a/org.eclipse.jdt.core.tests.compiler/pom.xml
+++ b/org.eclipse.jdt.core.tests.compiler/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2021 Eclipse Foundation and others.
+ Copyright (c) 2012, 2022 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -15,11 +15,11 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.jdt</groupId>
- <version>4.25.0-SNAPSHOT</version>
+ <version>4.26.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.core.tests.compiler</artifactId>
- <version>3.12.2000-SNAPSHOT</version>
+ <version>3.12.2050-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
@@ -202,15 +202,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>toolchain</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<toolchains>
<jdk>
@@ -232,15 +223,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>toolchain</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<toolchains>
<jdk>
@@ -262,15 +244,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>toolchain</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<toolchains>
<jdk>
@@ -285,6 +258,27 @@
<tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,15,18</tycho.surefire.argLine>
</properties>
</profile>
+ <profile>
+ <id>test-on-javase-19</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-toolchains-plugin</artifactId>
+ <configuration>
+ <toolchains>
+ <jdk>
+ <id>JavaSE-19</id>
+ </jdk>
+ </toolchains>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,17,19</tycho.surefire.argLine>
+ </properties>
+ </profile>
</profiles>
</project>
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
index 344628b87..3f89f8ac2 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java
@@ -241,6 +241,18 @@ public static TestSuite getTestSuite(boolean addComplianceDiagnoseTest) {
TestCase.RUN_ONLY_ID = null;
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_18), tests_18));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_19) != 0) {
+ ArrayList tests_19 = (ArrayList)testClasses.clone();
+ tests_19.addAll(TEST_CLASSES_1_5);
+ addJava16Tests(tests_19);
+ // Reset forgotten subsets tests
+ TestCase.TESTS_PREFIX = null;
+ TestCase.TESTS_NAMES = null;
+ TestCase.TESTS_NUMBERS= null;
+ TestCase.TESTS_RANGE = null;
+ TestCase.RUN_ONLY_ID = null;
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_19), tests_19));
+ }
return all;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest9.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest9.java
index ecfbe4cbb..bbccc9118 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest9.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest9.java
@@ -115,7 +115,7 @@ public class AbstractRegressionTest9 extends AbstractRegressionTest {
return null;
}
- private Parser createParser() {
+ public Parser createParser() {
Map<String,String> opts = new HashMap<String, String>();
opts.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_9);
return new Parser(
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
index a656fa296..b21af297d 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java
@@ -9869,7 +9869,7 @@ public void test292() {
}
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=316456
public void test293() {
- this.runNegativeTest(
+ this.runConformTest(
new String[] {
"X.java",
"@A(name = X.QUERY_NAME, query = X.QUERY)\n" +
@@ -9882,12 +9882,7 @@ public void test293() {
" String query();\n" +
"}\n"
},
- "----------\n" +
- "1. ERROR in X.java (at line 1)\n" +
- " @A(name = X.QUERY_NAME, query = X.QUERY)\n" +
- " ^^^^^\n" +
- "The field X.QUERY is not visible\n" +
- "----------\n");
+ "");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=179566
public void test294() {
@@ -12382,4 +12377,23 @@ public void testBug490698_comment16() {
"}\n"
});
}
+
+public void testBugVisibility() {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) {
+ return;
+ }
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " String z() { return Y.MSG; }\n" +
+ " @Deprecated(since = Y.MSG)\n" +
+ " static class Y {\n" +
+ " private final static String MSG = \"msg\";\n" +
+ " }\n" +
+ "}",
+ },
+ "");
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
index c4251c78e..03f1ecd32 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java
@@ -1061,7 +1061,7 @@ public void test012b(){
String logContents = Util.fileContent(logFileName);
String expectedLogContents =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
- "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.006 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_006.dtd\">\n" +
+ "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.006 Compiler//EN\" \"https://www.eclipse.org/jdt/core/compiler_32_006.dtd\">\n" +
"<compiler copyright=\"{2}\" name=\"{1}\" version=\"{3}\">\n" +
" <command_line>\n" +
" <argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.java\"/>\n" +
@@ -1095,6 +1095,7 @@ public void test012b(){
" <option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.emulateJavacBug8031744\" value=\"enabled\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" +
+ " <option key=\"org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage\" value=\"disabled\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.APILeak\" value=\"warning\"/>\n" +
" <option key=\"org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated\" value=\"info\"/>\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java
index e6f811b4e..0fb1a81e5 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
@@ -704,6 +704,7 @@ public void _test011_problem_categories() {
expectedProblemAttributes.put("InvalidUsageOfWildcard", new ProblemAttributes(CategorizedProblem.CAT_SYNTAX));
expectedProblemAttributes.put("InvalidVoidExpression", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("IsClassPathCorrect", new ProblemAttributes(CategorizedProblem.CAT_BUILDPATH));
+ expectedProblemAttributes.put("IsClassPathCorrectWithReferencingType", new ProblemAttributes(CategorizedProblem.CAT_BUILDPATH));
expectedProblemAttributes.put("JavadocAmbiguousConstructor", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocAmbiguousField", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
expectedProblemAttributes.put("JavadocAmbiguousMethod", new ProblemAttributes(CategorizedProblem.CAT_JAVADOC));
@@ -865,6 +866,7 @@ public void _test011_problem_categories() {
expectedProblemAttributes.put("NonGenericConstructor", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("NonGenericMethod", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("NonGenericType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
+ expectedProblemAttributes.put("NonNullArrayContentNotInitialized", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NonNullDefaultDetailIsNotEvaluated", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
expectedProblemAttributes.put("NonNullExpressionComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
expectedProblemAttributes.put("NonNullMessageSendComparisonYieldsFalse", new ProblemAttributes(CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM));
@@ -1399,6 +1401,10 @@ public void _test011_problem_categories() {
expectedProblemAttributes.put("EnhancedSwitchMissingDefault", new ProblemAttributes(true));
expectedProblemAttributes.put("DuplicateTotalPattern", new ProblemAttributes(true));
expectedProblemAttributes.put("UnexpectedTypeinSwitchPattern", new ProblemAttributes(true));
+ expectedProblemAttributes.put("UnexpectedTypeinRecordPattern", new ProblemAttributes(true));
+ expectedProblemAttributes.put("RecordPatternMismatch", new ProblemAttributes(true));
+ expectedProblemAttributes.put("PatternTypeMismatch", new ProblemAttributes(true));
+ expectedProblemAttributes.put("RawTypeInRecordPattern", new ProblemAttributes(true));
expectedProblemAttributes.put("ClassExtendFinalRecord", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("RecordErasureIncompatibilityInCanonicalConstructor", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
expectedProblemAttributes.put("JavadocInvalidModule", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
@@ -1872,6 +1878,7 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("InvalidUsageOfWildcard", SKIP);
expectedProblemAttributes.put("InvalidVoidExpression", SKIP);
expectedProblemAttributes.put("IsClassPathCorrect", SKIP);
+ expectedProblemAttributes.put("IsClassPathCorrectWithReferencingType", SKIP);
expectedProblemAttributes.put("JavadocAmbiguousConstructor", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocAmbiguousField", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
expectedProblemAttributes.put("JavadocAmbiguousMethod", new ProblemAttributes(JavaCore.COMPILER_PB_INVALID_JAVADOC));
@@ -2035,6 +2042,7 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("NonGenericConstructor", SKIP);
expectedProblemAttributes.put("NonGenericMethod", SKIP);
expectedProblemAttributes.put("NonGenericType", SKIP);
+ expectedProblemAttributes.put("NonNullArrayContentNotInitialized", SKIP);
expectedProblemAttributes.put("NonNullDefaultDetailIsNotEvaluated", SKIP);
expectedProblemAttributes.put("NonNullExpressionComparisonYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
expectedProblemAttributes.put("NonNullSpecdFieldComparisonYieldsFalse", new ProblemAttributes(JavaCore.COMPILER_PB_REDUNDANT_NULL_CHECK));
@@ -3105,6 +3113,10 @@ public void test012_compiler_problems_tuning() {
expectedProblemAttributes.put("EnhancedSwitchMissingDefault", SKIP);
expectedProblemAttributes.put("DuplicateTotalPattern", SKIP);
expectedProblemAttributes.put("UnexpectedTypeinSwitchPattern", SKIP);
+ expectedProblemAttributes.put("UnexpectedTypeinRecordPattern", SKIP);
+ expectedProblemAttributes.put("RecordPatternMismatch", SKIP);
+ expectedProblemAttributes.put("PatternTypeMismatch", SKIP);
+ expectedProblemAttributes.put("RawTypeInRecordPattern", SKIP);
expectedProblemAttributes.put("ClassExtendFinalRecord", SKIP);
expectedProblemAttributes.put("RecordErasureIncompatibilityInCanonicalConstructor", SKIP);
expectedProblemAttributes.put("JavadocInvalidModule", SKIP);
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index 5aa8de7e4..bf9d52758 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -50654,23 +50654,10 @@ public void test1436() {
" ^^^^^^^^^^^\n" +
"Type safety: Unchecked invocation foo(List, IllegalArgumentException) of the generic method foo(List<U>, T) of type X\n" +
"----------\n" +
- (this.complianceLevel < ClassFileConstants.JDK1_8
- ?
- "3. WARNING in X.java (at line 8)\n" +
- " foo(l, iae);\n" +
- " ^\n" +
- "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n"
- :
- "3. ERROR in X.java (at line 8)\n" +
- " foo(l, iae);\n" +
- " ^^^^^^^^^^^\n" +
- "Unhandled exception type Throwable\n" + // new error since 1.8 (bug 473657)
- "----------\n" +
- "4. WARNING in X.java (at line 8)\n" +
- " foo(l, iae);\n" +
- " ^\n" +
- "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n"
- ) +
+ "3. WARNING in X.java (at line 8)\n" +
+ " foo(l, iae);\n" +
+ " ^\n" +
+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
@@ -50702,23 +50689,10 @@ public void test1437() {
" ^^^^^^^^^^^^^\n" +
"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" +
"----------\n" +
- (this.complianceLevel < ClassFileConstants.JDK1_8
- ?
- "3. WARNING in X.java (at line 8)\n" +
- " new X(l, iae);\n" +
- " ^\n" +
- "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n"
- :
- "3. ERROR in X.java (at line 8)\n" +
- " new X(l, iae);\n" +
- " ^^^^^^^^^^^^^\n" +
- "Unhandled exception type Throwable\n" + // new error since 1.8 (bug 473657)
- "----------\n" +
- "4. WARNING in X.java (at line 8)\n" +
- " new X(l, iae);\n" +
- " ^\n" +
- "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n"
- ) +
+ "3. WARNING in X.java (at line 8)\n" +
+ " new X(l, iae);\n" +
+ " ^\n" +
+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
@@ -50750,23 +50724,10 @@ public void test1438() {
" ^^^^^^^^^^^^^^^\n" +
"Type safety: Unchecked invocation X(List, IllegalArgumentException) of the generic constructor X(List<U>, T) of type X\n" +
"----------\n" +
- (this.complianceLevel < ClassFileConstants.JDK1_8
- ?
- "3. WARNING in X.java (at line 8)\n" +
- " new X(l, iae){};\n" +
- " ^\n" +
- "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n"
- :
- "3. ERROR in X.java (at line 8)\n" +
- " new X(l, iae){};\n" +
- " ^^^^^^^^^^^^^^^\n" +
- "Unhandled exception type Throwable\n" + // new error since 1.8 (bug 473657)
- "----------\n" +
- "4. WARNING in X.java (at line 8)\n" +
- " new X(l, iae){};\n" +
- " ^\n" +
- "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n"
- ) +
+ "3. WARNING in X.java (at line 8)\n" +
+ " new X(l, iae){};\n" +
+ " ^\n" +
+ "Type safety: The expression of type List needs unchecked conversion to conform to List<List<?>>\n" +
"----------\n");
}
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=258798 - variation
@@ -50795,11 +50756,14 @@ public void test1439() {
" ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"Type safety: Unchecked invocation X(List, null) of the generic constructor X(List<U>, T) of type X\n" +
"----------\n" +
+ (this.complianceLevel < ClassFileConstants.JDK1_8 ?
"2. ERROR in X.java (at line 7)\n" +
" this((List) null, null);\n" +
" ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"Unhandled exception type Throwable\n" +
- "----------\n" +
+ "----------\n"
+ : "" // no error in 1.8 (bug GH472)
+ ) +
"3. WARNING in X.java (at line 7)\n" +
" this((List) null, null);\n" +
" ^^^^^^^^^^^\n" +
@@ -51083,16 +51047,22 @@ public void test1445() {
" ^^^^^^^^^^^^^^^\n" +
"Type safety: Unchecked invocation foo(List) of the generic method foo(List<T>) of type X\n" +
"----------\n" +
+ (this.complianceLevel < ClassFileConstants.JDK1_8 ?
"4. ERROR in X.java (at line 9)\n" +
" new X(l).foo(l);\n" +
" ^^^^^^^^\n" +
"Unhandled exception type Throwable\n" +
- "----------\n" +
+ "----------\n"
+ : "" // no error in 1.8 (bug GH472)
+ ) +
+ (this.complianceLevel < ClassFileConstants.JDK1_8 ?
"5. ERROR in X.java (at line 9)\n" +
" new X(l).foo(l);\n" +
" ^^^^^^^^^^^^^^^\n" +
"Unhandled exception type Throwable\n" +
- "----------\n" +
+ "----------\n"
+ : "" // no error in 1.8 (bug GH472)
+ ) +
"6. WARNING in X.java (at line 9)\n" +
" new X(l).foo(l);\n" +
" ^\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
index 89487cc89..e62b51474 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -6681,5 +6681,94 @@ public void testBug576524() {
);
}
}
+
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/472
+// If unchecked conversion was necessary for the arguments,
+// substitute and erase the return type.
+public void testBugGH472_a() {
+ if (this.complianceLevel >= ClassFileConstants.JDK1_8) {
+ this.runConformTest(
+ new String[] {
+ "ReturnTypeTest.java",
+ "public class ReturnTypeTest {\n"
+ + " <T> T m(Class<T> arg1, Class<T> arg2) { return null; }\n"
+ + "\n"
+ + " void test(Class c1, Class<Class<String>> c2) throws Exception {\n"
+ + " m(c1, c2).newInstance();\n"
+ + " }\n"
+ + "}"
+ }
+ );
+ }
+}
+
+// A variation for the unchecked conversion test case.
+// the type arguments contain wildcards like <? extends T>.
+public void testBugGH472_b() {
+ if (this.complianceLevel >= ClassFileConstants.JDK1_8) {
+ this.runConformTest(
+ new String[] {
+ "ReturnTypeTest.java",
+ "public class ReturnTypeTest {\n"
+ + " <T> T m(Class<T> arg1, Class<? extends T> arg2) { return null; }\n"
+ + "\n"
+ + " void test(Class c1, Class<Class<String>> c2) throws Exception {\n"
+ + " m(c1, c2).newInstance();\n"
+ + " }\n"
+ + "}"
+ }
+ );
+ }
+}
+
+// A variation for the unchecked conversion test case.
+// the type arguments contain wildcards like <? super T>.
+public void testBugGH472_c() {
+ if (this.complianceLevel >= ClassFileConstants.JDK1_8) {
+ this.runConformTest(
+ new String[] {
+ "ReturnTypeTest.java",
+ "public class ReturnTypeTest {\n"
+ + " <T> T m(Class<T> arg1, Class<? super T> arg2) { return null; }\n"
+ + "\n"
+ + " void test(Class c1, Class<Class<String>> c2) throws Exception {\n"
+ + " m(c1, c2).newInstance();\n"
+ + " }\n"
+ + "}"
+ }
+ );
+ }
+}
+
+// If unchecked conversion was necessary for the arguments,
+// substitute and erase the thrown type.
+public void testBugGH472_d() {
+ if (this.complianceLevel >= ClassFileConstants.JDK1_8) {
+ this.runConformTest(
+ new String[] {
+ "ThrowTest.java",
+ "public class ThrowTest {\n"
+ + "\n"
+ + " public static void test(MyDerivedException e, MyType t) {\n"
+ + " try {\n"
+ + " new Foo(e, t);\n"
+ + " } catch (MyDerivedException e2) {}\n"
+ + " }\n"
+ + "}\n"
+ + "\n"
+ + "class MyException extends Exception {}\n"
+ + "class MyDerivedException extends MyException {}\n"
+ + "\n"
+ + "class MyType<T> {}\n"
+ + "\n"
+ + "class Foo {\n"
+ + " public <E1 extends MyException> Foo(E1 e, MyType<String> a) throws E1 {\n"
+ + " throw e;\n"
+ + " }\n"
+ + "}"
+ }
+ );
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofPrimaryPatternTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofPrimaryPatternTest.java
index b150bcd16..6119473ce 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofPrimaryPatternTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofPrimaryPatternTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2021 IBM Corporation and others.
+ * Copyright (c) 2021, 2022 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
@@ -184,7 +184,17 @@ public class InstanceofPrimaryPatternTest extends AbstractRegressionTest {
"}\n",
},
"----------\n" +
- "1. ERROR in X.java (at line 9)\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " if (obj instanceof (String s && s.length() > 0)) {\n" +
+ " ^\n" +
+ "Syntax error, insert \")\" to complete ParenthesizedPattern\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 3)\n" +
+ " if (obj instanceof (String s && s.length() > 0)) {\n" +
+ " ^\n" +
+ "Syntax error on token \")\", delete this token\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 9)\n" +
" Zork();\n" +
" ^^^^\n" +
"The method Zork() is undefined for the type X\n" +
@@ -253,7 +263,7 @@ public class InstanceofPrimaryPatternTest extends AbstractRegressionTest {
"public class X {\n" +
" public static void foo(String s) {\n" +
" if (s instanceof Object o) {\n" +
- " System.out.println(s);\n" +
+ " System.out.println(s1);\n" +
" }\n " +
" }\n" +
" public static void main(String[] obj) {\n" +
@@ -262,10 +272,10 @@ public class InstanceofPrimaryPatternTest extends AbstractRegressionTest {
"}\n",
},
"----------\n" +
- "1. ERROR in X.java (at line 3)\n" +
- " if (s instanceof Object o) {\n" +
- " ^^^^^^^^^^^^^^^^^^^^^\n" +
- "Expression type cannot be a subtype of the Pattern type\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " System.out.println(s1);\n" +
+ " ^^\n" +
+ "s1 cannot be resolved to a variable\n" +
"----------\n");
}
} \ No newline at end of file
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests18.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests18.java
index b3b087fe2..a06bb27a6 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests18.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests18.java
@@ -37,7 +37,7 @@ public class NullAnnotationTests18 extends AbstractNullAnnotationTest {
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_18);
+ return buildMinimalComplianceTestSuite(testClass(), F_19);
}
public static Class<?> testClass() {
@@ -128,7 +128,7 @@ public class NullAnnotationTests18 extends AbstractNullAnnotationTest {
Runner runner = new Runner();
runner.classLibraries = this.LIBS;
Map<String,String> opts = getCompilerOptions();
- opts.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_18);
+ opts.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_19);
opts.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
opts.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
runner.customOptions = opts;
@@ -541,4 +541,91 @@ public class NullAnnotationTests18 extends AbstractNullAnnotationTest {
runner.expectedOutputString = "0";
runner.runConformTest();
}
+
+ public void testInstanceOfPatternIsNonNull() {
+ Runner runner = getDefaultRunner();
+ runner.testFiles = new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " public static void consumeNonNull(@NonNull String s) {\n" +
+ " System.out.println(\"nonnull\");\n" +
+ " }\n" +
+ " public static void main(String... args) {\n" +
+ " Object o = Math.random() < 0 ? new Object() : \"blah\";\n" +
+ " if (o instanceof String message) {\n" +
+ " consumeNonNull(message);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ };
+ runner.expectedCompilerLog = "";
+ runner.expectedOutputString = "nonnull";
+ runner.runConformTest();
+ }
+
+ public void testInstanceOfPatternIsLaterAssignedNull() {
+ Runner runner = getDefaultRunner();
+ runner.testFiles = new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.*;\n" +
+ "public class X {\n" +
+ " public static void consumeNonNull(@NonNull String s) {\n" +
+ " System.out.println(\"nonnull\");\n" +
+ " }\n" +
+ " public static void main(String... args) {\n" +
+ " Object o = Math.random() >= 0 ? new Object() : \"blah\";\n" +
+ " if (o instanceof String message) {\n" +
+ " consumeNonNull(message);\n" +
+ " message = null;\n" +
+ " consumeNonNull(message);\n" +
+ " }\n" +
+ " }\n" +
+ "}\n"
+ };
+ runner.expectedCompilerLog =
+ "----------\n" +
+ "1. ERROR in X.java (at line 11)\n" +
+ " consumeNonNull(message);\n" +
+ " ^^^^^^^\n" +
+ "Null type mismatch: required \'@NonNull String\' but the provided value is null\n" +
+ "----------\n";
+ runner.runNegativeTest();
+ }
+
+ // since 11: uses 'var'
+ public void testNullableVar() {
+ Runner runner = getDefaultRunner();
+ runner.testFiles = new String[] {
+ "Test.java",
+ "\n" +
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class Test {\n" +
+ " public @NonNull Test getSomeValue() { return this; }\n" +
+ " \n" +
+ " void test(boolean rainyDay) {\n" +
+ " var a = rainyDay ? getSomeValue() : null;\n" +
+ " a.getSomeValue(); // problem not detected\n" +
+ " }\n" +
+ " void test2(boolean rainyDay) {\n" +
+ " Test a = rainyDay ? getSomeValue() : null;\n" +
+ " a.getSomeValue(); // Potential null pointer access: The variable a may be null at this location\n" +
+ " }\n" +
+ "}\n"
+ };
+ runner.expectedCompilerLog =
+ "----------\n" +
+ "1. ERROR in Test.java (at line 9)\n" +
+ " a.getSomeValue(); // problem not detected\n" +
+ " ^\n" +
+ "Potential null pointer access: The variable a may be null at this location\n" +
+ "----------\n" +
+ "2. ERROR in Test.java (at line 13)\n" +
+ " a.getSomeValue(); // Potential null pointer access: The variable a may be null at this location\n" +
+ " ^\n" +
+ "Potential null pointer access: The variable a may be null at this location\n" +
+ "----------\n";
+ runner.runNegativeTest();
+ }
}
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 dc0b0bfbe..df2d3c0b3 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
@@ -3741,6 +3741,55 @@ public class NullTypeAnnotationTest extends AbstractNullAnnotationTest {
"----------\n");
}
+ public void testArray4() {
+ Map options = getCompilerOptions();
+ options.put(JavaCore.COMPILER_PB_ANNOTATED_TYPE_ARGUMENT_TO_UNANNOTATED, JavaCore.WARNING);
+ runNegativeTestWithLibs(
+ new String[] {
+ "X.java",
+ "import org.eclipse.jdt.annotation.NonNull;\n" +
+ "\n" +
+ "public class X<T> {\n" +
+ " \n" +
+ " void ok() {\n" +
+ " @NonNull String @NonNull [] s0 = new @NonNull String @NonNull [0];\n" + // array exists, but no contents that could be null
+ " @NonNull String @NonNull[]@NonNull[] s2 = new @NonNull String @NonNull[2]@NonNull[0];\n" + // inner arrays will be null
+ " String []@NonNull[] s4 = new String [getDims()]@NonNull[1];\n" + // leaves are null but that's ok
+ " @NonNull String @NonNull[][] s5 = new @NonNull String @NonNull[5][];\n" + // OK: outer array exists, inner arrays are unannotated
+ " }\n" +
+ " void nok() {\n" +
+ " @NonNull String @NonNull [] s1 = new @NonNull String @NonNull [1];\n" +
+ " @NonNull String @NonNull[]@NonNull[] s2 = new @NonNull String @NonNull[2]@NonNull[];\n" + // inner arrays will be null
+ " @NonNull String @NonNull[][] s3 = new @NonNull String @NonNull[1][3];\n" + // leaf cells will be null
+ " @NonNull String @NonNull[]@NonNull[] s6 = new @NonNull String @NonNull[5]@NonNull[];\n" +
+ " }\n" +
+ " int getDims() { return 1; }\n" +
+ "}"
+ },
+ options,
+ "----------\n" +
+ "1. INFO in X.java (at line 12)\n" +
+ " @NonNull String @NonNull [] s1 = new @NonNull String @NonNull [1];\n" +
+ " ^^^\n" +
+ "This array dimension with declared element type @NonNull String will be initialized with \'null\' entries\n" +
+ "----------\n" +
+ "2. INFO in X.java (at line 13)\n" +
+ " @NonNull String @NonNull[]@NonNull[] s2 = new @NonNull String @NonNull[2]@NonNull[];\n" +
+ " ^^^\n" +
+ "This array dimension with declared element type @NonNull String @NonNull[] will be initialized with \'null\' entries\n" +
+ "----------\n" +
+ "3. INFO in X.java (at line 14)\n" +
+ " @NonNull String @NonNull[][] s3 = new @NonNull String @NonNull[1][3];\n" +
+ " ^^^\n" +
+ "This array dimension with declared element type @NonNull String will be initialized with \'null\' entries\n" +
+ "----------\n" +
+ "4. INFO in X.java (at line 15)\n" +
+ " @NonNull String @NonNull[]@NonNull[] s6 = new @NonNull String @NonNull[5]@NonNull[];\n" +
+ " ^^^\n" +
+ "This array dimension with declared element type @NonNull String @NonNull[] will be initialized with \'null\' entries\n" +
+ "----------\n");
+ }
+
public void testBug417759() {
runNegativeTestWithLibs(
new String[] {
@@ -4456,7 +4505,12 @@ public void testBug427163c() {
" ^^^^^^^^^^^^^^^^^^\n" +
"Contradictory null specification; only one of @NonNull and @Nullable can be specified at any location\n" +
"----------\n" +
- "5. ERROR in X.java (at line 8)\n" +
+ "5. INFO in X.java (at line 7)\n" +
+ " String[] strings4 = new @NonNull String @Nullable @NonNull[1];\n" +
+ " ^^^\n" +
+ "This array dimension with declared element type @NonNull String will be initialized with \'null\' entries\n" +
+ "----------\n" +
+ "6. ERROR in X.java (at line 8)\n" +
" String[][] strings5 = new String[] @NonNull @Nullable[] {};\n" +
" ^^^^^^^^^^^^^^^^^^\n" +
"Contradictory null specification; only one of @NonNull and @Nullable can be specified at any location\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java
index f4a7fea6d..6a2568e66 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java
@@ -1030,6 +1030,7 @@ public class PatternMatching16Test extends AbstractRegressionTest {
options);
}
/* Test that we report subtypes of pattern variables used in the same stmt
+ * As of Java 19, we no longer report error for the above
*/
public void test020() {
Map<String, String> options = getCompilerOptions(true);
@@ -1042,15 +1043,15 @@ public class PatternMatching16Test extends AbstractRegressionTest {
" }\n" +
" public static void foo(Object[] o) {\n" +
" boolean b = (o instanceof String[] s) && s instanceof CharSequence[] s2;\n" +
- " System.out.print(b);\n" +
+ " System.out.print(b1);\n" +
" }\n" +
"}\n",
},
"----------\n" +
- "1. ERROR in X20.java (at line 6)\n" +
- " boolean b = (o instanceof String[] s) && s instanceof CharSequence[] s2;\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
- "Expression type cannot be a subtype of the Pattern type\n" +
+ "1. ERROR in X20.java (at line 7)\n" +
+ " System.out.print(b1);\n" +
+ " ^^\n" +
+ "b1 cannot be resolved to a variable\n" +
"----------\n",
"",
null,
@@ -2418,16 +2419,16 @@ public class PatternMatching16Test extends AbstractRegressionTest {
" return true;\n" +
" }\n" +
" public static void main(String argv[]) {\n" +
- " System.out.println(\"\");\n" +
+ " System.out.println(abc);\n" +
" }\n" +
"}\n",
},
"----------\n" +
- "1. ERROR in X.java (at line 4)\n" +
- " if (null instanceof T t) {\n" +
- " ^^^^^^^^^^^^^^^^^^^\n" +
- "Expression type cannot be a subtype of the Pattern type\n" +
- "----------\n",
+ "1. ERROR in X.java (at line 10)\n" +
+ " System.out.println(abc);\n" +
+ " ^^^\n" +
+ "abc cannot be resolved to a variable\n" +
+ "----------\n",
"",
null,
true,
@@ -3927,59 +3928,55 @@ public class PatternMatching16Test extends AbstractRegressionTest {
" }\n" +
" }\n" +
"}";
- String expectedOutput = ""
- + " // Method descriptor #15 ([Ljava/lang/String;)V\n"
- + " // Stack: 4, Locals: 4\n"
- + " public static void main(String[] args);\n"
- + " 0 ldc <String \"OK: \"> [16]\n"
- + " 2 astore_1 [y]\n"
- + " 3 ldc <String \"local\"> [18]\n"
- + " 5 astore_3 [ instanceOfPatternExpressionValue]\n"
- + " 6 aload_3 [ instanceOfPatternExpressionValue]\n"
- + " 7 instanceof String [20]\n"
- + " 10 ifeq 50\n"
- + " 13 aload_3 [ instanceOfPatternExpressionValue]\n"
- + " 14 checkcast String [20]\n"
- + " 17 dup\n"
- + " 18 astore_2\n"
- + " 19 aload_3\n"
- + " 20 checkcast String [20]\n"
- + " 23 if_acmpne 50\n"
- + " 26 getstatic System.out : PrintStream [22]\n"
- + " 29 new StringBuilder [28]\n"
- + " 32 dup\n"
- + " 33 aload_1 [y]\n"
- + " 34 invokestatic String.valueOf(Object) : String [30]\n"
- + " 37 invokespecial StringBuilder(String) [34]\n"
- + " 40 aload_2 [x]\n"
- + " 41 invokevirtual StringBuilder.append(String) : StringBuilder [37]\n"
- + " 44 invokevirtual StringBuilder.toString() : String [41]\n"
- + " 47 invokevirtual PrintStream.println(String) : void [45]\n"
- + " 50 return\n"
- + " Line numbers:\n"
- + " [pc: 0, line: 13]\n"
- + " [pc: 3, line: 14]\n"
- + " [pc: 26, line: 15]\n"
- + " [pc: 50, line: 17]\n"
- + " Local variable table:\n"
- + " [pc: 0, pc: 51] local: args index: 0 type: String[]\n"
- + " [pc: 3, pc: 51] local: y index: 1 type: String\n"
- + " [pc: 26, pc: 50] local: x index: 2 type: String\n"
- + " [pc: 6, pc: 20] local: instanceOfPatternExpressionValue index: 3 type: Object\n"
- + " Stack map table: number of frames 1\n"
- + " [pc: 50, append: {String}]\n"
- + " RuntimeVisibleTypeAnnotations: \n"
- + " #59 @Type(\n"
- + " target type = 0x40 LOCAL_VARIABLE\n"
- + " local variable entries:\n"
- + " [pc: 3, pc: 51] index: 1\n"
- + " )\n"
- + " #59 @Type(\n"
- + " target type = 0x40 LOCAL_VARIABLE\n"
- + " local variable entries:\n"
- + " [pc: 26, pc: 50] index: 2\n"
- + " )\n"
- + "\n";
+ String expectedOutput = " public static void main(String[] args);\n" +
+ " 0 ldc <String \"OK: \"> [16]\n" +
+ " 2 astore_1 [y]\n" +
+ " 3 ldc <String \"local\"> [18]\n" +
+ " 5 astore 4\n" +
+ " 7 aload 4\n" +
+ " 9 instanceof String [20]\n" +
+ " 12 ifeq 54\n" +
+ " 15 aload 4\n" +
+ " 17 checkcast String [20]\n" +
+ " 20 dup\n" +
+ " 21 astore_2\n" +
+ " 22 aload 4\n" +
+ " 24 checkcast String [20]\n" +
+ " 27 if_acmpne 54\n" +
+ " 30 getstatic System.out : PrintStream [22]\n" +
+ " 33 new StringBuilder [28]\n" +
+ " 36 dup\n" +
+ " 37 aload_1 [y]\n" +
+ " 38 invokestatic String.valueOf(Object) : String [30]\n" +
+ " 41 invokespecial StringBuilder(String) [34]\n" +
+ " 44 aload_2 [x]\n" +
+ " 45 invokevirtual StringBuilder.append(String) : StringBuilder [37]\n" +
+ " 48 invokevirtual StringBuilder.toString() : String [41]\n" +
+ " 51 invokevirtual PrintStream.println(String) : void [45]\n" +
+ " 54 return\n" +
+ " Line numbers:\n" +
+ " [pc: 0, line: 13]\n" +
+ " [pc: 3, line: 14]\n" +
+ " [pc: 30, line: 15]\n" +
+ " [pc: 54, line: 17]\n" +
+ " Local variable table:\n" +
+ " [pc: 0, pc: 55] local: args index: 0 type: String[]\n" +
+ " [pc: 3, pc: 55] local: y index: 1 type: String\n" +
+ " [pc: 30, pc: 54] local: x index: 2 type: String\n" +
+ " Stack map table: number of frames 1\n" +
+ " [pc: 54, append: {String}]\n" +
+ " RuntimeVisibleTypeAnnotations: \n" +
+ " #57 @Type(\n" +
+ " target type = 0x40 LOCAL_VARIABLE\n" +
+ " local variable entries:\n" +
+ " [pc: 3, pc: 55] index: 1\n" +
+ " )\n" +
+ " #57 @Type(\n" +
+ " target type = 0x40 LOCAL_VARIABLE\n" +
+ " local variable entries:\n" +
+ " [pc: 30, pc: 54] index: 2\n" +
+ " )\n" +
+ "\n";
checkClassFile("Test", source, expectedOutput, ClassFileBytesDisassembler.DETAILED | ClassFileBytesDisassembler.COMPACT);
runConformTest(
new String[] {
@@ -3993,6 +3990,39 @@ public class PatternMatching16Test extends AbstractRegressionTest {
public void testBug578628_1() {
if (this.complianceLevel < ClassFileConstants.JDK18)
return;
+ runNegativeTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"
+ + " public static Object str = \"a\";\n"
+ + " public static void foo() {\n"
+ + " if (str instanceof (String a && a == null)) {\n"
+ + " System.out.println(true);\n"
+ + " } else {\n"
+ + " System.out.println(false);\n"
+ + " }\n"
+ + " } \n"
+ + " public static void main(String[] argv) {\n"
+ + " foo();\n"
+ + " }\n"
+ + "}",
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (str instanceof (String a && a == null)) {\n" +
+ " ^\n" +
+ "Syntax error, insert \")\" to complete ParenthesizedPattern\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " if (str instanceof (String a && a == null)) {\n" +
+ " ^\n" +
+ "Syntax error on token \")\", delete this token\n" +
+ "----------\n",
+ false);
+ }
+ public void testBug578628_1a() {
+ if (this.complianceLevel < ClassFileConstants.JDK18)
+ return;
Map<String, String> compilerOptions = getCompilerOptions(true);
runConformTest(
new String[] {
@@ -4000,7 +4030,7 @@ public class PatternMatching16Test extends AbstractRegressionTest {
"public class X {\n"
+ " public static Object str = \"a\";\n"
+ " public static void foo() {\n"
- + " if (str instanceof (String a && a == null)) {\n"
+ + " if (str instanceof String a && a == null) {\n"
+ " System.out.println(true);\n"
+ " } else {\n"
+ " System.out.println(false);\n"
@@ -4024,7 +4054,7 @@ public class PatternMatching16Test extends AbstractRegressionTest {
"public class X {\n"
+ " public static Object str = \"a\";\n"
+ " public static void foo() {\n"
- + " if (str instanceof (String a && a != null)) {\n"
+ + " if (str instanceof String a && a != null) {\n"
+ " System.out.println(true);\n"
+ " } else {\n"
+ " System.out.println(false);\n"
@@ -4048,7 +4078,7 @@ public class PatternMatching16Test extends AbstractRegressionTest {
"public class X {\n"
+ " public static Object str = \"a\";\n"
+ " public static void foo() {\n"
- + " bar(str instanceof (String a && a == null));\n"
+ + " bar(str instanceof String a && a == null);\n"
+ " } \n"
+ " public static void bar(boolean arg) {\n"
+ " System.out.println(arg);\n"
@@ -4062,7 +4092,7 @@ public class PatternMatching16Test extends AbstractRegressionTest {
compilerOptions);
}
public void testBug578628_4() {
- if (this.complianceLevel < ClassFileConstants.JDK18)
+ if (this.complianceLevel < ClassFileConstants.JDK19)
return;
Map<String, String> compilerOptions = getCompilerOptions(true);
runConformTest(
@@ -4073,7 +4103,7 @@ public class PatternMatching16Test extends AbstractRegressionTest {
+ "public static void foo() {\n"
+ " boolean b = switch (str) {\n"
+ " case String s -> {\n"
- + " yield (str instanceof (String a && a != null));\n"
+ + " yield (str instanceof String a && a != null);\n"
+ " }\n"
+ " default -> false;\n"
+ " };\n"
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
index 1a01b6263..5af1988a4 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java
@@ -382,7 +382,7 @@ public void test004() {
"1. ERROR in X.java (at line 1)\n" +
" import p.OtherFoo;\n" +
" ^\n" +
- "The type q.Zork cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type q.Zork cannot be resolved. It is indirectly referenced from required type p.OtherFoo\n" +
"----------\n" +
"2. ERROR in X.java (at line 2)\n" +
" import q.Zork;\n" +
@@ -498,7 +498,7 @@ public void test005() {
"1. ERROR in X.java (at line 4)\n" +
" ofoo.bar();\n" +
" ^^^^^^^^^^\n" +
- "The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required type p.OtherFoo\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
" ofoo.bar();\n" +
@@ -565,7 +565,7 @@ public void test006() {
"2. ERROR in X.java (at line 5)\n" +
" ofoo.bar();\n" +
" ^^^^^^^^^^\n" +
- "The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required type p.OtherFoo\n" +
"----------\n" +
"3. ERROR in X.java (at line 5)\n" +
" ofoo.bar();\n" +
@@ -632,7 +632,7 @@ public void test007() {
"2. ERROR in X.java (at line 5)\n" +
" ofoo.bar();\n" +
" ^^^^^^^^^^\n" +
- "The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type q1.q2.Zork cannot be resolved. It is indirectly referenced from required type p.OtherFoo\n" +
"----------\n" +
"3. ERROR in X.java (at line 5)\n" +
" ofoo.bar();\n" +
@@ -8783,4 +8783,49 @@ public void testBug542829() {
};
runner.runConformTest();
}
+public void testBug576735() {
+ if (this.complianceLevel < ClassFileConstants.JDK1_5) return;
+
+ String path = getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "lib576735.jar";
+ String[] libs = getDefaultClassPaths();
+ int len = libs.length;
+ System.arraycopy(libs, 0, libs = new String[len+1], 0, len);
+ libs[len] = path;
+ Runner runner = new Runner();
+ runner.classLibraries = libs;
+ runner.customOptions = getCompilerOptions();
+ runner.customOptions.put(CompilerOptions.OPTION_Process_Annotations, CompilerOptions.ENABLED);
+ runner.testFiles = new String[] {
+ "does/not/Work.java",
+ "package does.not;\n" + // force this package to exist
+ "public interface Work {}",
+ "p/X.java",
+ "package p;\n" +
+ "import does.not.Work;\n" +
+ "import good.WithAnnotatedMethod;\n" +
+ "import does.not.ExistAnnotation;\n" + // resolving this triggers the location-less error
+ "public class X {\n" +
+ " WithAnnotatedMethod field;\n" + // trigger creation of the BTB(WithAnnotatedMethod) and the URB(does.not.ExistAnnotation)
+ " void meth0(@ExistAnnotation Work d) {\n" + // force resolving of URB(does.not.ExistAnnotation)
+ " }\n" +
+ "}\n"};
+ runner.expectedCompilerLog =
+ "----------\n" +
+ "1. ERROR in p\\X.java (at line 1)\n" +
+ " package p;\n" +
+ " ^\n" +
+ "The type does.not.ExistAnnotation cannot be resolved. It is indirectly referenced from required type good.WithAnnotatedMethod\n" +
+ "----------\n" +
+ "2. ERROR in p\\X.java (at line 4)\n" +
+ " import does.not.ExistAnnotation;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The import does.not.ExistAnnotation cannot be resolved\n" +
+ "----------\n" +
+ "3. ERROR in p\\X.java (at line 7)\n" +
+ " void meth0(@ExistAnnotation Work d) {\n" +
+ " ^^^^^^^^^^^^^^^\n" +
+ "ExistAnnotation cannot be resolved to a type\n" +
+ "----------\n";
+ runner.runNegativeTest();
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java
new file mode 100644
index 000000000..299c5e3a1
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java
@@ -0,0 +1,1667 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.compiler.regression;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.compiler.batch.FileSystem;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
+import junit.framework.Test;
+
+public class RecordPatternTest extends AbstractRegressionTest9 {
+
+ private static final JavacTestOptions JAVAC_OPTIONS = new JavacTestOptions("-source 19 --enable-preview -Xlint:-preview");
+ static {
+// TESTS_NUMBERS = new int [] { 40 };
+// TESTS_RANGE = new int[] { 1, -1 };
+// TESTS_NAMES = new String[] { "test25" };
+ }
+ private String extraLibPath;
+ public static Class<?> testClass() {
+ return RecordPatternTest.class;
+ }
+ public static Test suite() {
+ return buildMinimalComplianceTestSuite(testClass(), F_19);
+ }
+ public RecordPatternTest(String testName){
+ super(testName);
+ }
+ // Enables the tests to run individually
+ protected Map<String, String> getCompilerOptions(boolean preview) {
+ Map<String, String> defaultOptions = super.getCompilerOptions();
+ if (this.complianceLevel >= ClassFileConstants.getLatestJDKLevel()
+ && preview) {
+ defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
+ }
+ return defaultOptions;
+ }
+
+ protected Map<String, String> getCompilerOptions() {
+ return getCompilerOptions(true);
+ }
+ protected String[] getDefaultClassPaths() {
+ String[] libs = DefaultJavaRuntimeEnvironment.getDefaultClassPaths();
+ if (this.extraLibPath != null) {
+ String[] l = new String[libs.length + 1];
+ System.arraycopy(libs, 0, l, 0, libs.length);
+ l[libs.length] = this.extraLibPath;
+ return l;
+ }
+ return libs;
+ }
+ @Override
+ protected INameEnvironment getNameEnvironment(final String[] testFiles, String[] classPaths, Map<String, String> options) {
+ this.classpaths = classPaths == null ? getDefaultClassPaths() : classPaths;
+ INameEnvironment[] classLibs = getClassLibs(false, options);
+ for (INameEnvironment nameEnvironment : classLibs) {
+ ((FileSystem) nameEnvironment).scanForModules(createParser());
+ }
+ return new InMemoryNameEnvironment9(testFiles, this.moduleMap, classLibs);
+ }
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput) {
+ runConformTest(testFiles, expectedOutput, getCompilerOptions(true));
+ }
+ @Override
+ protected void runConformTest(String[] testFiles, String expectedOutput, Map<String, String> customOptions) {
+ if(!isJRE19Plus)
+ return;
+ runConformTest(testFiles, expectedOutput, customOptions, new String[] {"--enable-preview"}, JAVAC_OPTIONS);
+ }
+ protected void runConformTest(
+ String[] testFiles,
+ String expectedOutputString,
+ String[] classLibraries,
+ boolean shouldFlushOutputDirectory,
+ String[] vmArguments) {
+ runTest(
+ // test directory preparation
+ shouldFlushOutputDirectory /* should flush output directory */,
+ testFiles /* test files */,
+ // compiler options
+ classLibraries /* class libraries */,
+ null /* no custom options */,
+ false /* do not perform statements recovery */,
+ null /* no custom requestor */,
+ // compiler results
+ false /* expecting no compiler errors */,
+ null /* do not check compiler log */,
+ // runtime options
+ false /* do not force execution */,
+ vmArguments /* vm arguments */,
+ // runtime results
+ expectedOutputString /* expected output string */,
+ null /* do not check error string */,
+ // javac options
+ JavacTestOptions.DEFAULT /* default javac test options */);
+ }
+ protected void runNegativeTest(
+ String[] testFiles,
+ String expectedCompilerLog,
+ String javacLog,
+ String[] classLibraries,
+ boolean shouldFlushOutputDirectory,
+ Map<String, String> customOptions) {
+ Runner runner = new Runner();
+ runner.testFiles = testFiles;
+ runner.expectedCompilerLog = expectedCompilerLog;
+ runner.javacTestOptions = JAVAC_OPTIONS;
+ runner.customOptions = customOptions;
+ runner.expectedJavacOutputString = javacLog;
+ runner.runNegativeTest();
+ }
+ /*
+ * Basic tests that accept a valid record pattern and make the pattern variable available
+ */
+ public void test001() {
+ Map<String, String> options = getCompilerOptions(true);
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "Upper-left corner: Rectangle[upperLeft=ColoredPoint[p=Point[x=0, y=0], c=BLUE], lowerRight=ColoredPoint[p=Point[x=10, y=15], c=RED]]",
+ options);
+ }
+ // Test that pattern variables are allowed for the nested patterns (not just the outermost record pattern)
+ public void test002() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "1");
+ }
+ public void test003() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr))) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " System.out.println(\"Upper-left corner: \" + r1);\n" +
+ " ^^\n" +
+ "r1 cannot be resolved to a variable\n" +
+ "----------\n");
+ }
+ public void test004() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr))) {\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new PointTypo(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " print(new Rectangle(new ColoredPoint(new PointTypo(0, 0), Color.BLUE),\n" +
+ " ^^^^^^^^^\n" +
+ "PointTypo cannot be resolved to a type\n" +
+ "----------\n");
+ }
+ // Test that non record types are reported in a record pattern
+ public void test005() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int i, int j), Color c),\n"
+ + " ColoredPoint lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "class Point{}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (r instanceof (Rectangle(ColoredPoint(Point(int i, int j), Color c),\n" +
+ " ^^^^^\n" +
+ "Only record types are permitted in a record pattern\n" +
+ "----------\n");
+ }
+ // Test that record patterns that don't have same no of patterns as record components are reported
+ public void test006() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int i), Color c),\n"
+ + " ColoredPoint lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (r instanceof (Rectangle(ColoredPoint(Point(int i), Color c),\n" +
+ " ^^^^^^^^^^^^\n" +
+ "Record pattern should match the signature of the record declaration\n" +
+ "----------\n");
+ }
+ public void test007() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(String o1, String o2), Color c),\n"
+ + " ColoredPoint lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (r instanceof (Rectangle(ColoredPoint(Point(String o1, String o2), Color c),\n" +
+ " ^^^^^^^^^\n" +
+ "Pattern of type int is not compatible with type java.lang.String\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 4)\n" +
+ " if (r instanceof (Rectangle(ColoredPoint(Point(String o1, String o2), Color c),\n" +
+ " ^^^^^^^^^\n" +
+ "Pattern of type int is not compatible with type java.lang.String\n" +
+ "----------\n");
+ }
+ // Test that pattern types that don't match record component's types are reported
+ public void test008() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int i, int j), Color c), ColoredPoint lr, Object obj) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (r instanceof (Rectangle(ColoredPoint(Point(int i, int j), Color c), ColoredPoint lr, Object obj) r1)) {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "Record pattern should match the signature of the record declaration\n" +
+ "----------\n");
+ }
+ // Test that A pattern p dominates a record pattern with type R if p is unconditional at R.
+ // case Rectangle c -> {
+ // yield 0;
+ // }
+ // case Rectangle(ColoredPoint(Point(int x, int y), Color c),
+ // ColoredPoint(Point(int x1, int y1), Color c1)) r1 -> {
+ // yield r1.lowerRight().p().y();
+ // }
+ public void test009() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle c -> {\n"
+ + " yield 0;\n"
+ + " }\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint(Point(int x1, int y1), Color c1)) r1 -> {\n"
+ + " yield r1.lowerRight().p().y();\n"
+ + " }\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 8)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ColoredPoint(Point(int x1, int y1), Color c1)) r1 -> {\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that nested pattern variables from record patterns are in scope in the case block
+ public void test10() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " System.out.println(\"x= \" + x);\n"
+ + " System.out.println(\"y= \" + y);\n"
+ + " System.out.println(\"lr= \" + lr);\n"
+ + " System.out.println(\"lr.c()= \" + lr.c());\n"
+ + " System.out.println(\"lr.p()= \" + lr.p());\n"
+ + " System.out.println(\"lr.p().x()= \" + lr.p().x());\n"
+ + " System.out.println(\"lr.p().y()= \" + lr.p().y());\n"
+ + " System.out.println(\"c= \" + c);\n"
+ + " System.out.println(\"r1= \" + r1);\n"
+ + " yield x;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "x= 15\n" +
+ "y= 5\n" +
+ "lr= ColoredPoint[p=Point[x=30, y=10], c=RED]\n" +
+ "lr.c()= RED\n" +
+ "lr.p()= Point[x=30, y=10]\n" +
+ "lr.p().x()= 30\n" +
+ "lr.p().y()= 10\n" +
+ "c= BLUE\n" +
+ "r1= Rectangle[upperLeft=ColoredPoint[p=Point[x=15, y=5], c=BLUE], lowerRight=ColoredPoint[p=Point[x=30, y=10], c=RED]]\n" +
+ "Returns: 15");
+ }
+ // Test that nested pattern variables from record patterns are in not scope outside the case block
+ public void test11() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint(Point(int x1, int y1), Color c1)) r1 -> {\n"
+ + " yield r1.lowerRight().p().y();\n"
+ + " }\n"
+ + " default -> {yield x;}"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " default -> {yield x;} };\n" +
+ " ^\n" +
+ "x cannot be resolved to a variable\n" +
+ "----------\n");
+ }
+ // Test that nested pattern variables from record patterns are in not scope outside the case block
+ public void test12() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint(Point(int x1, int y1), Color c1)) r1 -> {\n"
+ + " yield r1.lowerRight().p().y();\n"
+ + " }\n"
+ + " default -> {yield r1.upperLeft().p().x();}"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 9)\n" +
+ " default -> {yield r1.upperLeft().p().x();} };\n" +
+ " ^^\n" +
+ "r1 cannot be resolved\n" +
+ "----------\n");
+ }
+ // Test that when expressions are supported and pattern variables are available inside when expressions
+ public void test13() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x > 0 -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x <= 0 -> {\n"
+ + " yield -1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(5, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "Returns: -1\n" +
+ "Returns: 1");
+ }
+ // Test that record patterns with 1 record components are accepted
+ public void test14() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void print(Record r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Record(int x) r1 -> x ;\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Record(3));\n"
+ + " }\n"
+ + "}\n"
+ + "record Record(int x) {}\n"
+ },
+ "Returns: 3");
+ }
+ // Test that record patterns with 0 record components are accepted
+ public void test15() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Pair p) {\n"
+ + " if (p instanceof Pair(Teacher(Object n), Student(Object n1, Integer i)) r1) {\n"
+ + " System.out.println(r1);\n"
+ + " } else {\n"
+ + " System.out.println(\"ELSE\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair(new Teacher(\"123\"), new Student(\"abc\", 1)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, Integer id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "Pair[s=Teacher[name=123], s1=Student[name=abc, id=1]]");
+ }
+ // Should not reach IF or throw CCE.
+ // Should reach ELSE
+ public void test16() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Pair p) {\n"
+ + " if (p instanceof Pair(Teacher(Object n), Student(Object n1, Integer i)) r1) {\n"
+ + " System.out.println(\"IF\");\n"
+ + " } else {\n"
+ + " System.out.println(\"ELSE\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair(new Student(\"abc\", 1), new Teacher(\"123\")));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, Integer id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "ELSE");
+ }
+ public void test17() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Pair p) {\n"
+ + " if (p instanceof Pair(Teacher(Object n), Student(Object n1, Integer i)) r1) {\n"
+ + " System.out.println(n1.getClass().getTypeName() + \":\" + n1 + \",\" + i);\n"
+ + " } else {\n"
+ + " System.out.println(\"ELSE\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair(new Teacher(\"123\"), new Student(\"abc\", 10)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, Integer id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "java.lang.String:abc,10");
+ }
+ // Same as 17(), but base type instead of wrapper
+ public void test18() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Pair p) {\n"
+ + " if (p instanceof Pair(Teacher(Object n), Student(Object n1, int i)) r1) {\n"
+ + " System.out.println(n1.getClass().getTypeName() + \":\" + n1 + \",\" + i);\n"
+ + " } else {\n"
+ + " System.out.println(\"ELSE\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair(new Teacher(\"123\"), new Student(\"abc\", 10)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, int id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "java.lang.String:abc,10");
+ }
+ public void test19() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Pair p) {\n"
+ + " int res1 = switch(p) {\n"
+ + " case Pair(Student(Object n1, int i), Teacher(Object n)) r1 -> {\n"
+ + " yield i;\n"
+ + " }\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res1);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair( new Student(\"abc\", 15), new Teacher(\"123\")));\n"
+ + " print(new Pair( new Teacher(\"123\"), new Student(\"abc\", 1)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, int id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "15\n"
+ + "-1");
+ }
+ // Test that Object being pattern-checked works in switch-case
+ public void test20() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Object p) {\n"
+ + " int res1 = switch(p) {\n"
+ + " case Pair(Student(Object n1, int i), Teacher(Object n)) p1 -> {\n"
+ + " yield i;\n"
+ + " }\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res1);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair( new Student(\"abc\", 15), new Teacher(\"123\")));\n"
+ + " print(new Pair( new Teacher(\"123\"), new Student(\"abc\", 1)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, int id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "15\n"
+ + "-1");
+ }
+ // // Test that Object being pattern-checked works in 'instanceof'
+ public void test21() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Object p) {\n"
+ + " if (p instanceof Pair(Student(Object n1, int i), Teacher(Object n)) p1) {\n"
+ + " System.out.println(i);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair( new Student(\"abc\", 15), new Teacher(\"123\")));\n"
+ + " print(new Pair( new Teacher(\"123\"), new Student(\"abc\", 1)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, int id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ },
+ "15");
+ }
+ // Nested record pattern with a simple (constant) 'when' clause
+ public void test22() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x > 1 -> {\n"
+ + " System.out.println(\"one\");\n"
+ + " yield x;\n"
+ + " }\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x <= 0 -> {\n"
+ + " System.out.println(\"two\"); \n"
+ + " yield x;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(5, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "two\n" +
+ "Returns: 0\n" +
+ "one\n" +
+ "Returns: 5");
+ }
+ // Nested record pattern with a method invocation in a 'when' clause
+ public void test23 () {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x > value() -> {\n"
+ + " System.out.println(\"one\");\n"
+ + " yield x;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static int value() {\n"
+ + " return 0;\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(5, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "Returns: 0\n" +
+ "one\n" +
+ "Returns: 5");
+ }
+ // Nested record pattern with another switch expression + record pattern in a 'when' clause
+ // Failing now.
+ public void test24() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void printLowerRight(Object r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x >\n"
+ + " switch(r) {\n"
+ + " case Rectangle(ColoredPoint c1, ColoredPoint lr1) r2 -> 2;\n"
+ + " default -> 3;\n"
+ + " }\n"
+ + " -> x;\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(5, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "Returns: 0\n" +
+ "Returns: 5");
+ }
+ public void test24a() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void printLowerRight(Object r) {\n"
+ + " int x = 0;\n"
+ + " if (r instanceof Rectangle(ColoredPoint c, ColoredPoint lr) r1 && x < switch(r) {\n"
+ + " case Rectangle(ColoredPoint c1, ColoredPoint lr1) r2 -> 2;\n"
+ + " default -> 3;\n"
+ + " }) {\n"
+ + " System.out.println(\"IF\");\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(5, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "IF\n" +
+ "IF");
+ }
+ //https://github.com/eclipse-jdt/eclipse.jdt.core/issues/157
+ public void test25() {
+ String currentWorkingDirectoryPath = System.getProperty("user.dir");
+ this.extraLibPath = currentWorkingDirectoryPath + File.separator + "libtest25.jar";
+ try {
+ Util.createJar(
+ new String[] {
+ "p/RecordPattern1.java;\n",
+ "package p;\n"
+ + "public class RecordPattern1 {}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color {\n"
+ + " RED, GREEN, BLUE\n"
+ + "}\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}\n"
+ },
+ this.extraLibPath,
+ JavaCore.VERSION_19,
+ true);
+ // new String[] {libPath}
+ this.runConformTest(
+ new String[] {
+ "p/X.java",
+ "package p;\n"
+ + "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE),\n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ },
+ "1",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ null,
+ null);
+ } catch (IOException e) {
+ System.err.println("RecordPatternTest.test25() could not write to current working directory " + currentWorkingDirectoryPath);
+ } finally {
+ new File(this.extraLibPath).delete();
+ }
+ }
+ // Test that pattern variables declared in instanceof can't be used in a switch/case
+ public void test26() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 && x > (switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " })) {\n"
+ + " System.out.println(x);\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ^\n" +
+ "Duplicate local variable x\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 6)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ^\n" +
+ "Duplicate local variable y\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 6)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ^\n" +
+ "Duplicate local variable c\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 7)\n" +
+ " ColoredPoint lr) r1 -> {\n" +
+ " ^^\n" +
+ "Duplicate local variable lr\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 7)\n" +
+ " ColoredPoint lr) r1 -> {\n" +
+ " ^^\n" +
+ "Duplicate local variable r1\n" +
+ "----------\n");
+ }
+ // Test that pattern variables declared in switch/case can't be used in an instanceof expression part of the 'when' clause
+ public void test27() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r1 instanceof Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1) -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r1 instanceof Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ^\n" +
+ "Duplicate local variable x\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 5)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r1 instanceof Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ^\n" +
+ "Duplicate local variable y\n" +
+ "----------\n" +
+ "3. ERROR in X.java (at line 5)\n" +
+ " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r1 instanceof Rectangle(ColoredPoint(Point(int x, int y), Color c),\n" +
+ " ^\n" +
+ "Duplicate local variable c\n" +
+ "----------\n" +
+ "4. ERROR in X.java (at line 6)\n" +
+ " ColoredPoint lr) r1) -> {\n" +
+ " ^^\n" +
+ "Duplicate local variable lr\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 6)\n" +
+ " ColoredPoint lr) r1) -> {\n" +
+ " ^^\n" +
+ "Duplicate local variable r1\n" +
+ "----------\n");
+ }
+ // Test nested record patterns in 'instanceof' within a swith-case with similar record pattern
+ public void test28() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r instanceof Rectangle(ColoredPoint(Point(int x1, int y1), Color c1),\n"
+ + " ColoredPoint lr1) r2) -> {\n"
+ + " yield lr1.p().y();\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(1,1), Color.RED), new ColoredPoint(new Point(5,5), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "5",
+ null,
+ true,
+ new String[] {"--enable-preview"},
+ null,
+ null);
+ }
+ // Test that a simple type pattern dominates a following record pattern of the same type
+ public void test29() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case R r -> 1;\n"
+ + " case R(int a) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case R(int a) -> 0;\n" +
+ " ^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that an identical record pattern dominates another record pattern
+ public void test30() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case R(int a) r -> 1;\n"
+ + " case R(int a) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case R(int a) -> 0;\n" +
+ " ^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that a type pattern with 'when' does not dominate a record pattern of the same type
+ public void test31() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " public boolean predicate() { return true; }\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case R r when predicate() -> 1;\n"
+ + " case R(int a) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new R(10));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "1");
+ }
+ // Test that a type pattern with 'when' does not dominate a record pattern of the same type
+ public void test31a() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " public boolean predicate() { return false; }\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case R r when predicate() -> 1;\n"
+ + " case R(int a) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new R(10));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "0");
+ }
+ // Test that a record pattern with 'when' does not dominate an identical record pattern
+ public void test32() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " public boolean predicate() { return true; }\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case R(int a) r when predicate() -> 1;\n"
+ + " case R(int a) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new R(10));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "1");
+ }
+ // Test that a record pattern with 'when' does not dominate an identical record pattern
+ public void test32a() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " public boolean predicate() { return false; }\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case R(int a) r when predicate() -> 1;\n"
+ + " case R(int a) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new R(10));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "0");
+ }
+ // Test that a parenthesized type pattern dominates a record pattern of the same type
+ public void test33() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case ((R r)) -> 1;\n"
+ + " case ((R(int a))) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case ((R(int a))) -> 0;\n" +
+ " ^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that a parenthesized record pattern dominates an identical record pattern
+ public void test34() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case ((R(int a))) -> 1;\n"
+ + " case ((R(int a))) -> 0;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case ((R(int a))) -> 0;\n" +
+ " ^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that pattern dominance is reported on identical nested record pattern
+ public void test35() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case Pair(Teacher(Object n), Student(Object n1, Integer i)) -> 0;\n"
+ + " case Pair(Teacher(Object n), Student(Object n1, Integer i)) r1 -> 1;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new Pair(new Teacher(\"123\"), new Student(\"abc\", 10)));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + "record Student(String name, Integer id) implements Person {}\n"
+ + "record Teacher(String name) implements Person {}\n"
+ + "record Pair(Person s, Person s1) {} "
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case Pair(Teacher(Object n), Student(Object n1, Integer i)) r1 -> 1;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that pattern dominance is reported on identical nested record pattern
+ public void test36() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case Pair(Teacher(Object n), Student(Object n1, Integer i)) -> 0;\n"
+ + " case Pair(Teacher(Object n), Student(String n1, Integer i)) r1 -> 1;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new Pair(new Teacher(\"123\"), new Student(\"abc\", 10)));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + "record Student(String name, Integer id) implements Person {}\n"
+ + "record Teacher(String name) implements Person {}\n"
+ + "record Pair(Person s, Person s1) {} "
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " case Pair(Teacher(Object n), Student(String n1, Integer i)) r1 -> 1;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "This case label is dominated by one of the preceding case label\n" +
+ "----------\n");
+ }
+ // Test that pattern dominance is reported on identical nested record pattern
+ public void test37() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public void foo(Object o) {\n"
+ + " int res = switch (o) {\n"
+ + " case Pair(Teacher(Object n), Student(String n1, Integer i)) -> 0;\n"
+ + " case Pair(Teacher(Object n), Student(Object n1, Integer i)) r1 -> 1;\n"
+ + " default -> -1;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " (new X()).foo(new Pair(new Teacher(\"123\"), new Student(\"abc\", 10)));\n"
+ + " }\n"
+ + "}\n"
+ + "record R(int i) {}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + "record Student(String name, Integer id) implements Person {}\n"
+ + "record Teacher(String name) implements Person {}\n"
+ + "record Pair(Person s, Person s1) {} "
+ },
+ "0");
+ }
+ // Test that null is not matched to any pattern
+ public void test38() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r instanceof Rectangle(ColoredPoint(Point(int x1, int y1), Color c1),\n"
+ + " ColoredPoint lr1) r2) -> {\n"
+ + " yield lr1.p().y();\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Rectangle(new ColoredPoint(null, Color.RED), new ColoredPoint(new Point(5,5), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "0");
+ }
+ public void test39() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r instanceof Rectangle(ColoredPoint(Point(int x1, int y1), Color c1),\n"
+ + " ColoredPoint lr1) r2) -> {\n"
+ + " yield lr1.p().y();\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Rectangle(null, null));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "0");
+ }
+ public void test40() {
+ runConformTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c), ColoredPoint lr) r1 when (r instanceof Rectangle(ColoredPoint(Point(int x1, int y1), Color c1),\n"
+ + " ColoredPoint lr1) r2) -> {\n"
+ + " yield lr1.p().y();\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " };\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " try {\n"
+ + " print(null);\n"
+ + " } catch(NullPointerException e) {\n"
+ + " System.out.println(\"NPE with \" + e.toString());\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "NPE with java.lang.NullPointerException");
+ }
+ public void test41() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void printLowerRight(Object r) {\n"
+ + " long res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(var x, long y), Color c), \n"
+ + " ColoredPoint lr) r1 when x > \n"
+ + " switch(r) {\n"
+ + " case Rectangle(ColoredPoint c1, ColoredPoint lr1) r2 -> 2; \n"
+ + " default -> 10; \n"
+ + " } \n"
+ + " -> x + 10; \n"
+ + " default -> 0; \n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " } \n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(2, 4), Color.GREEN), new ColoredPoint(new Point(5, 4), Color.GREEN))); \n"
+ + " }\n"
+ + "}\n"
+ + "record Point(long x, long y) {} \n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {} \n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "Returns: 0");
+ }
+ public void test42() {
+ runConformTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void printLowerRight(Object r) {\n"
+ + " long res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(var x, long y), Color c), \n"
+ + " ColoredPoint lr) r1 when x > \n"
+ + " switch(r) {\n"
+ + " case Rectangle(ColoredPoint c1, var lr1) r2 -> lr1.p().x();\n"
+ + " default -> 10; \n"
+ + " } \n"
+ + " -> x + 10; \n"
+ + " default -> 0; \n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " } \n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(10, 4), Color.GREEN), new ColoredPoint(new Point(5, 4), Color.GREEN))); \n"
+ + " }\n"
+ + "}\n"
+ + "record Point(long x, long y) {} \n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {} \n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "Returns: 20");
+ }
+ public void test43() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void printLowerRight(Object r) {\n"
+ + " long res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(var x, long y), Color c), \n"
+ + " ColoredPoint lr) r1 when x > \n"
+ + " switch(r) {\n"
+ + " case Rectangle(ColoredPoint c1, ColoredPoint lr1) r2 -> 2; \n"
+ + " default -> 10; \n"
+ + " } \n"
+ + " -> x + 10; \n"
+ + " default -> 0; \n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " } \n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(2, 4), Color.GREEN), new ColoredPoint(new Point(5, 4), Color.GREEN))); \n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {} \n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {} \n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " case Rectangle(ColoredPoint(Point(var x, long y), Color c), \n" +
+ " ^^^^^^\n" +
+ "Pattern of type int is not compatible with type long\n" +
+ "----------\n");
+ }
+ public void test44() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void printLowerRight(Object r) {\n"
+ + " long res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(var x, int y), Color c), \n"
+ + " ColoredPoint lr) r1 when x > \n"
+ + " switch(r) {\n"
+ + " case Rectangle(ColoredPoint c1, ColoredPoint lr1) r2 -> 2; \n"
+ + " default -> 10; \n"
+ + " } \n"
+ + " -> x + 10; \n"
+ + " default -> 0; \n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " } \n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(2, 4), Color.GREEN), new ColoredPoint(new Point(5, 4), Color.GREEN))); \n"
+ + " }\n"
+ + "}\n"
+ + "record Point(long x, long y) {} \n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {} \n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 5)\n" +
+ " case Rectangle(ColoredPoint(Point(var x, int y), Color c), \n" +
+ " ^^^^^\n" +
+ "Pattern of type long is not compatible with type int\n" +
+ "----------\n");
+ }
+ public void test45() {
+ runNegativeTest(new String[] {
+ "X.java",
+ "@SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void print(Object r) {\n"
+ + " switch (r) {\n"
+ + " case Rectangle r1 when (r instanceof (Rectangle(ColoredPoint upperLeft2, ColoredPoint lowerRight) r2)):\n"
+ + " System.out.println(r2);// error should not be reported here\n"
+ + " break;\n"
+ + " }\n"
+ + " }\n"
+ + "}\n"
+ + "record ColoredPoint() {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {} "
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " switch (r) {\n" +
+ " ^\n" +
+ "An enhanced switch statement should be exhaustive; a default label expected\n" +
+ "----------\n");
+ }
+ public void test46() {
+ runConformTest(new String[] {
+ "X.java",
+ " @SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void printGenericBoxString1(Box<Object> objectBox) {\n"
+ + " if (objectBox instanceof Box<Object>(String s)) {\n"
+ + " System.out.println(s); \n"
+ + " }\n"
+ + " }\n"
+ + "static void printGenericBoxString2(Box<String> stringBox) {\n"
+ + " if (stringBox instanceof Box<String>(var s)) {\n"
+ + " System.out.println(s);\n"
+ + " }\n"
+ + " }\n"
+ + "public static void main(String[] args) {\n"
+ + " printGenericBoxString1(new Box(\"Hello\"));\n"
+ + " Object o = new Integer(10);\n"
+ + " Box<Object> box = new Box(o);\n"
+ + " printGenericBoxString1(box);\n"
+ + "}\n"
+ + "}\n"
+ + "record Box<T>(T t) {} "
+ },
+ "Hello");
+ }
+ public void test47() {
+ runNegativeTest(new String[] {
+ "X.java",
+ " @SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " static void printGenericBoxString1(Box<Object> objectBox) {\n"
+ + " if (objectBox instanceof Box<String>(String s)) {\n"
+ + " System.out.println(s); // this one should report an unsafe cast error\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] args) {}\n"
+ + "}\n"
+ + "record Box<T>(T t) {} "
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 4)\n" +
+ " if (objectBox instanceof Box<String>(String s)) {\n" +
+ " ^^^^^^^^^\n" +
+ "Type Box<Object> cannot be safely cast to Box<String>\n" +
+ "----------\n");
+ }
+ public void test48() {
+ runNegativeTest(new String[] {
+ "X.java",
+ " @SuppressWarnings(\"preview\")\n"
+ + "public class X {\n"
+ + " public static void main(String[] args) {\n"
+ + " erroneousTest1(new Box<>(\"A\"));\n"
+ + " erroneousTest2(new Box<>(\"B\"));\n"
+ + " }\n"
+ + " static void erroneousTest1(Box<Object> bo) {\n"
+ + " if (bo instanceof Box(var s)) {\n"
+ + " System.out.println(\"I'm a box\");\n"
+ + " }\n"
+ + " }\n"
+ + " static void erroneousTest2(Box b) {\n"
+ + " if (b instanceof Box(var t)) {\n"
+ + " System.out.println(\"I'm a box\");\n"
+ + " }\n"
+ + " }\n"
+ + " record Box<T> (T t) {\n"
+ + " }\n"
+ + "}"
+ },
+ "----------\n" +
+ "1. WARNING in X.java (at line 8)\n" +
+ " if (bo instanceof Box(var s)) {\n" +
+ " ^^^\n" +
+ "X.Box is a raw type. References to generic type X.Box<T> should be parameterized\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 8)\n" +
+ " if (bo instanceof Box(var s)) {\n" +
+ " ^^^\n" +
+ "Raw types are not allowed in record patterns\n" +
+ "----------\n" +
+ "3. WARNING in X.java (at line 12)\n" +
+ " static void erroneousTest2(Box b) {\n" +
+ " ^^^\n" +
+ "X.Box is a raw type. References to generic type X.Box<T> should be parameterized\n" +
+ "----------\n" +
+ "4. WARNING in X.java (at line 13)\n" +
+ " if (b instanceof Box(var t)) {\n" +
+ " ^^^\n" +
+ "X.Box is a raw type. References to generic type X.Box<T> should be parameterized\n" +
+ "----------\n" +
+ "5. ERROR in X.java (at line 13)\n" +
+ " if (b instanceof Box(var t)) {\n" +
+ " ^^^\n" +
+ "Raw types are not allowed in record patterns\n" +
+ "----------\n");
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
index 51a5471d4..993234735 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
@@ -9141,5 +9141,36 @@ public void testBug577251_001() {
"Erasure incompatibility in argument X.Entry of canonical constructor in record\n" +
"----------\n");
}
-
+public void testBug576806_001() {
+ Map<String, String> options = getCompilerOptions();
+ options.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR);
+ this.runNegativeTest(
+ false /* skipJavac */,
+ new JavacTestOptions("Xlint:empty"),
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " public static void main(String[] args){\n"+
+ " System.out.println(0);\n" +
+ " }\n"+
+ "}\n"+
+ "record Empty(){\n"+
+ "}\n"+
+ "record DocumentedEmpty(){\n"+
+ " // intentionally empty\n"+
+ "}\n"+
+ "record Point(int x, int y){\n"+
+ "}"
+ },
+ "----------\n" +
+ "1. ERROR in X.java (at line 6)\n" +
+ " record Empty(){\n" +
+ "}\n" +
+ " ^^^^\n" +
+ "Empty block should be documented\n" +
+ "----------\n",
+ null,
+ false,
+ options);
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
index bb953eaf8..31c99dd4f 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java
@@ -1790,4 +1790,71 @@ public class ScannerTest extends AbstractRegressionTest {
assertTrue(false);
}
}
+ public void testWhenOK() {
+ String source = ("public void foo(Object obj) {\n switch(obj) {\n case String s when s.length() > 0 -> {}\n}\n}");
+ IScanner scanner = ToolFactory.createScanner(false, true, false, "19", "19", true);
+ scanner.setSource(source.toCharArray());
+ scanner.resetTo(source.indexOf("when")-1, source.length() - 1); // start directly at "when"
+ try {
+ int token;
+ while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
+ switch (token) {
+ case ITerminalSymbols.TokenNameWHITESPACE:
+ break;
+ case ITerminalSymbols.TokenNameRestrictedIdentifierWhen:
+ return; // success
+ default:
+ fail("Unexpected token "+token);
+ }
+ }
+ fail("TokenNameRestrictedIdentifierYield was not detected");
+ } catch (InvalidInputException e) {
+ assertTrue(false);
+ }
+ }
+ @SuppressWarnings("deprecation")
+ public void testWhenKO() {
+ String source = ("public void foo(Object obj) {\n switch(obj) {\n case String s when s.length() > 0 -> {}\n}\n}");
+ IScanner scanner = ToolFactory.createScanner(false, true, false, "19", "19", false);
+ scanner.setSource(source.toCharArray());
+ scanner.resetTo(source.indexOf("when")-1, source.length() - 1); // start directly at "when"
+ try {
+ int token;
+ while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
+ switch (token) {
+ case ITerminalSymbols.TokenNameWHITESPACE:
+ break;
+ case ITerminalSymbols.TokenNameIdentifier:
+ return; // success
+ case ITerminalSymbols.TokenNameRestrictedIdentifierWhen:
+ default:
+ fail("Unexpected token "+token);
+ }
+ }
+ fail("TokenNameRestrictedIdentifierYield was not detected");
+ } catch (InvalidInputException e) {
+ assertTrue(false);
+ }
+ }
+
+ public void testWhenAsIdentifier() {
+ String source =
+ "public void when(Object when) {\n" +
+ " Predicate<Object> condition = o -> when(o);\n" +
+ " SomeClass.when(condition).when();\n" +
+ " SomeClass./*comment*/when(condition,/*comment*/when(false)). when(true);\n" +
+ "}";
+ IScanner scanner = ToolFactory.createScanner(true, true, true, "19", "19", true);
+ scanner.setSource(source.toCharArray());
+ try {
+ int token;
+ while ((token = scanner.getNextToken()) != ITerminalSymbols.TokenNameEOF) {
+ if (token == ITerminalSymbols.TokenNameRestrictedIdentifierWhen) {
+ fail("TokenNameRestrictedIdentifierWhen must not be detected");
+ }
+ }
+ } catch (InvalidInputException e) {
+ assertTrue(false);
+ }
+ }
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java
index 326de6aea..3d5381107 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java
@@ -29,16 +29,16 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
static {
// TESTS_NUMBERS = new int [] { 40 };
// TESTS_RANGE = new int[] { 1, -1 };
-// TESTS_NAMES = new String[] { "testBug579355"};
+// TESTS_NAMES = new String[] { "testBug578132_001"};
}
- private static String previewLevel = "18";
+ private static String previewLevel = "19";
public static Class<?> testClass() {
return SwitchPatternTest.class;
}
public static Test suite() {
- return buildMinimalComplianceTestSuite(testClass(), F_18);
+ return buildMinimalComplianceTestSuite(testClass(), F_19);
}
public SwitchPatternTest(String testName){
super(testName);
@@ -47,9 +47,9 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
// Enables the tests to run individually
protected Map<String, String> getCompilerOptions() {
Map<String, String> defaultOptions = super.getCompilerOptions();
- defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_18);
- defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_18);
- defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_18);
+ defaultOptions.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_19);
+ defaultOptions.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_19);
+ defaultOptions.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_19);
defaultOptions.put(CompilerOptions.OPTION_EnablePreviews, CompilerOptions.ENABLED);
defaultOptions.put(CompilerOptions.OPTION_ReportPreviewFeatures, CompilerOptions.IGNORE);
defaultOptions.put(CompilerOptions.OPTION_Store_Annotations, CompilerOptions.ENABLED);
@@ -126,7 +126,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
assertEquals("Wrong contents", expectedOutput, result);
}
}
- public void testBug573516_001() {
+ public void testIssue57_001() {
runConformTest(
new String[] {
"X.java",
@@ -145,6 +145,25 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"String: Hello World!");
}
+ public void testIssue57_002() {
+ runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n"+
+ " private static void foo(Object o) {\n"+
+ " switch (o) {\n"+
+ " case Integer i when i > 10 -> System.out.println(\"Integer: greater than 10\");\n"+
+ " case String s -> System.out.println(\"String: Hello World!\");\n"+
+ " default -> System.out.println(\"Object\");\n"+
+ " }\n"+
+ " }\n"+
+ " public static void main(String[] args) {\n"+
+ " foo(12);\n"+
+ " }\n"+
+ "}",
+ },
+ "Integer: greater than 10");
+ }
public void testBug573516_002() {
runNegativeTest(
new String[] {
@@ -201,7 +220,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
- " case Integer t && t > 0 -> System.out.println(\"Integer && t > 0\");\n"+
+ " case Integer t when t > 0 -> System.out.println(\"Integer && t > 0\");\n"+
" default -> System.out.println(\"Object\");\n"+
" }\n"+
" }\n"+
@@ -255,7 +274,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
- " case Integer t, String s && s.length > 0, X x && x.hashCode() > 10 : System.out.println(\"Integer, String or X\");\n"+
+ " case Integer t, String s when s.length > 0, X x when x.hashCode() > 10 : System.out.println(\"Integer, String or X\");\n"+
" default : System.out.println(\"Object\");\n"+
" }\n"+
" }\n"+
@@ -268,13 +287,13 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
- " case Integer t, String s && s.length > 0, X x && x.hashCode() > 10 : System.out.println(\"Integer, String or X\");\n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ " case Integer t, String s when s.length > 0, X x when x.hashCode() > 10 : System.out.println(\"Integer, String or X\");\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"A switch label may not have more than one pattern case label element\n" +
"----------\n" +
"2. ERROR in X.java (at line 4)\n" +
- " case Integer t, String s && s.length > 0, X x && x.hashCode() > 10 : System.out.println(\"Integer, String or X\");\n" +
- " ^^^^^^\n" +
+ " case Integer t, String s when s.length > 0, X x when x.hashCode() > 10 : System.out.println(\"Integer, String or X\");\n" +
+ " ^^^^^^\n" +
"length cannot be resolved or is not a field\n" +
"----------\n" +
"3. ERROR in X.java (at line 10)\n" +
@@ -488,7 +507,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" case Integer I: \n"+
" System.out.println(\"Integer\"); \n"+
" System.out.println(I); \n"+
- " case String s && s.length()>1: \n"+
+ " case String s when s.length()>1: \n"+
" System.out.println(\"String s && s.length()>1\"); \n"+
" System.out.println(s); \n"+
" break;// error no fallthrough allowed in pattern\n"+
@@ -509,8 +528,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 7)\n" +
- " case String s && s.length()>1: \n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ " case String s when s.length()>1: \n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"Illegal fall-through to a pattern\n" +
"----------\n");
}
@@ -553,7 +572,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
" case Integer I: System.out.println(\"Integer\"); break;\n"+
- " case String s && s.length()>1: System.out.println(\"String > 1\"); break;\n"+
+ " case String s when s.length()>1: System.out.println(\"String > 1\"); break;\n"+
" case String s1: System.out.println(\"String\"); break;\n"+
" case X x: System.out.println(\"X\"); break;\n"+
" default : System.out.println(\"Object\");\n"+
@@ -582,8 +601,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" System.out.println(\"Integer\"); \n"+
" System.out.println(I); \n"+
" break; \n"+
- " case String s && s.length()>1: \n"+
- " System.out.println(\"String s && s.length()>1\"); \n"+
+ " case String s when s.length()>1: \n"+
+ " System.out.println(\"String s when s.length()>1\"); \n"+
" System.out.println(s); \n"+
" break;\n"+
" case String s1: \n"+
@@ -605,7 +624,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" public static Object bar() { return new Object();}\n"+
"}",
},
- "String s && s.length()>1\n" +
+ "String s when s.length()>1\n" +
"Hello World!\n" +
"String\n" +
"H\n" +
@@ -622,8 +641,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" System.out.println(\"Integer\"); \n"+
" System.out.println(I); \n"+
" break; \n"+
- " case String s && s.length()>1: \n"+
- " System.out.println(\"String s && s.length()>1\"); \n"+
+ " case String s when s.length()>1: \n"+
+ " System.out.println(\"String s when s.length()>1\"); \n"+
" System.out.println(s); \n"+
" break;\n"+
" case String s: \n"+
@@ -645,7 +664,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" public static Object bar() { return new Object();}\n"+
"}",
},
- "String s && s.length()>1\n" +
+ "String s when s.length()>1\n" +
"Hello World!\n" +
"String\n" +
"H\n" +
@@ -710,8 +729,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" System.out.println(\"Integer\"); \n"+
" System.out.println(I); \n"+
" break; \n"+
- " case String s && s.length()>1: \n"+
- " System.out.println(\"String s && s.length()>1\"); \n"+
+ " case String s when s.length()>1: \n"+
+ " System.out.println(\"String s when s.length()>1\"); \n"+
" System.out.println(s); \n"+
" break;\n"+
" case String s1: \n"+
@@ -736,7 +755,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" public static Object bar() { return new Object();}\n"+
"}",
},
- "String s && s.length()>1\n" +
+ "String s when s.length()>1\n" +
"Hello World!\n" +
"NULL\n" +
"Object");
@@ -806,10 +825,10 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"\n"+
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
- " case Integer i && i>10:\n"+
+ " case Integer i when i>10:\n"+
" System.out.println(\"Greater than 10:\" + o);\n"+
" break;\n"+
- " case Integer j && j>0:\n"+
+ " case Integer j when j>0:\n"+
" System.out.println(\"Greater than 0:\" + o);\n"+
" break;\n"+
" default:\n"+
@@ -834,8 +853,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"\n"+
" private static void foo1(Object o) {\n"+
" switch (o) {\n"+
- " case Integer i&&i>10 -> System.out.println(\"Greater than 10:\");\n"+
- " case String s&&s.equals(\"ff\") -> System.out.println(\"String:\" + s);\n"+
+ " case Integer i when i>10 -> System.out.println(\"Greater than 10:\");\n"+
+ " case String s when s.equals(\"ff\") -> System.out.println(\"String:\" + s);\n"+
" default -> System.out.println(\"Object:\" + o);\n"+
" }\n"+
" }\n"+
@@ -878,10 +897,10 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"\n"+
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
- " case Integer i && i>10:\n"+
+ " case Integer i when i>10:\n"+
" System.out.println(\"Greater than 10:\" + o);\n"+
" break;\n"+
- " case Integer j && j>0:\n"+
+ " case Integer j when j>0:\n"+
" System.out.println(\"Greater than 0:\" + o);\n"+
" break;\n"+
" case default:\n"+
@@ -1182,7 +1201,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " switch (o) {\n"
+ " case Integer i1:\n"
+ " break;\n"
- + " case String s1 && s1.length() > i1:\n"
+ + " case String s1 when s1.length() > i1:\n"
+ " System.out.println(s1.length());\n"
+ " break;\n"
+ " default:\n"
@@ -1193,8 +1212,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 6)\n" +
- " case String s1 && s1.length() > i1:\n" +
- " ^^\n" +
+ " case String s1 when s1.length() > i1:\n" +
+ " ^^\n" +
"i1 cannot be resolved to a variable\n" +
"----------\n");
}
@@ -1209,7 +1228,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " public static void foo(Object o) {\n"
+ " try {\n"
+ " switch (o) {\n"
- + " case String s1 && s1.length() == 0:\n"
+ + " case String s1 when s1.length() == 0:\n"
+ " break;"
+ " case String s1:\n"
+ " s1 = null;\n"
@@ -1279,7 +1298,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " public static void foo(Object o) {\n"
+ " int len = 2;\n"
+ " switch (o) {\n"
- + " case String o1 && o1.length() > len:\n"
+ + " case String o1 when o1.length() > len:\n"
+ " len = 0;\n"
+ " break;\n"
+ " default:\n"
@@ -1290,8 +1309,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
- " case String o1 && o1.length() > len:\n" +
- " ^^^\n" +
+ " case String o1 when o1.length() > len:\n" +
+ " ^^^\n" +
"Local variable len referenced from a guard must be final or effectively final\n" +
"----------\n");
}
@@ -1305,7 +1324,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " public static void foo(Object o) {\n"
+ " int len = 2;\n"
+ " switch (o) {\n"
- + " case String o1 && len < o1.length():\n"
+ + " case String o1 when len < o1.length():\n"
+ " len = 0;\n"
+ " break;\n"
+ " default:\n"
@@ -1316,8 +1335,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 5)\n" +
- " case String o1 && len < o1.length():\n" +
- " ^^^\n" +
+ " case String o1 when len < o1.length():\n" +
+ " ^^^\n" +
"Local variable len referenced from a guard must be final or effectively final\n" +
"----------\n");
}
@@ -1331,7 +1350,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " public static void foo(Object o) {\n"
+ " final int len = 2;\n"
+ " switch (o) {\n"
- + " case String o1 && len < o1.length():\n"
+ + " case String o1 when len < o1.length():\n"
+ " len = 0;\n"
+ " break;\n"
+ " default:\n"
@@ -1355,7 +1374,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " public static void foo(Object o) {\n"
+ " int len = 2;\n"
+ " switch (o) {\n"
- + " case String o1 && len < o1.length():\n"
+ + " case String o1 when len < o1.length():\n"
+ " System.out.println(o1);\n"
+ " break;\n"
+ " default:\n"
@@ -2276,7 +2295,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
- " case null, Integer i && i > 10 -> System.out.println(0);\n"+
+ " case null, Integer i when i > 10 -> System.out.println(0);\n"+
" default -> System.out.println(o);\n"+
" }\n"+
" Zork();\n"+
@@ -2285,8 +2304,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
- " case null, Integer i && i > 10 -> System.out.println(0);\n" +
- " ^^^^^^^^^^^^^^^^^^^\n" +
+ " case null, Integer i when i > 10 -> System.out.println(0);\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^\n" +
"A null case label and patterns can co-exist only if the pattern is a type pattern\n" +
"----------\n" +
"2. ERROR in X.java (at line 7)\n" +
@@ -2302,7 +2321,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" private static void foo(Object o) {\n"+
" switch (o) {\n"+
- " case Integer i && i > 10, null -> System.out.println(0);\n"+
+ " case Integer i when i > 10, null -> System.out.println(0);\n"+
" default -> System.out.println(o);\n"+
" }\n"+
" Zork();\n"+
@@ -2311,8 +2330,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
- " case Integer i && i > 10, null -> System.out.println(0);\n" +
- " ^^^^\n" +
+ " case Integer i when i > 10, null -> System.out.println(0);\n" +
+ " ^^^^\n" +
"A null case label and patterns can co-exist only if the pattern is a type pattern\n" +
"----------\n" +
"2. ERROR in X.java (at line 7)\n" +
@@ -2351,7 +2370,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" String s1 = \" Hello \";\n"+
" String s2 = \"World!\";\n"+
" switch (o) {\n"+
- " case Integer I && I > 10: break;\n"+
+ " case Integer I when I > 10: break;\n"+
" case X J: break;\n"+
" case String s : break;\n"+
" default:\n"+
@@ -2401,7 +2420,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" switch(o) {\n" +
" case CharSequence cs ->\n" +
" System.out.println(\"A sequence of length \" + cs.length());\n" +
- " case String s && s.length() > 0 -> \n" +
+ " case String s when s.length() > 0 -> \n" +
" System.out.println(\"A string: \" + s);\n" +
" default -> {\n" +
" break;\n" +
@@ -2412,8 +2431,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 6)\n" +
- " case String s && s.length() > 0 -> \n" +
- " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ " case String s when s.length() > 0 -> \n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
"This case label is dominated by one of the preceding case label\n" +
"----------\n");
}
@@ -2501,10 +2520,10 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" }\n"+
" private static void foo(Object o) {\n"+
" switch(o) {\n" +
- " case String s && s.length() < 5 :\n" +
+ " case String s when s.length() < 5 :\n" +
" System.out.println(\"1:\" + s);\n" +
" break;\n" +
- " case String s && s.length() == 5:\n" +
+ " case String s when s.length() == 5:\n" +
" System.out.println(\"2:\" + s);\n" +
" break;\n" +
" default : System.out.println(\"Object\");\n" +
@@ -2524,10 +2543,10 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" }\n"+
" private static void foo(Object o) {\n"+
" switch(o) {\n" +
- " case String s && s.length() < 5 :\n" +
+ " case String s when s.length() < 5 :\n" +
" System.out.println(\"1:\" + s);\n" +
" break;\n" +
- " case String s && s.length() == 5:\n" +
+ " case String s when s.length() == 5:\n" +
" System.out.println(\"2:\" + s);\n" +
" break;\n" +
" default : System.out.println(\"Object\");\n" +
@@ -2618,7 +2637,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 8)\n" +
" default: \n" +
" ^^^^^^^\n" +
- "Switch case cannot have both a total pattern and default label\n" +
+ "Switch case cannot have both unconditional pattern and default label\n" +
"----------\n");
}
public void testBug573921_10() {
@@ -2642,7 +2661,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 8)\n" +
" default: \n" +
" ^^^^^^^\n" +
- "Switch case cannot have both a total pattern and default label\n" +
+ "Switch case cannot have both unconditional pattern and default label\n" +
"----------\n");
}
public void testBug573921_11() {
@@ -2666,7 +2685,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 8)\n" +
" default: \n" +
" ^^^^^^^\n" +
- "Switch case cannot have both a total pattern and default label\n" +
+ "Switch case cannot have both unconditional pattern and default label\n" +
"----------\n");
}
public void testBug575049_001() {
@@ -2790,7 +2809,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 5)\n" +
" case Integer i1 -> 0;\n" +
" ^^^^^^^^^^^^^^^\n" +
- "Switch case cannot have both a total pattern and default label\n" +
+ "Switch case cannot have both unconditional pattern and default label\n" +
"----------\n");
}
public void testBug575053_001() {
@@ -2800,7 +2819,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n" +
" public void foo(String o) {\n" +
" switch (o) {\n" +
- " case String s && s.length() > 0 -> {}\n" +
+ " case String s when s.length() > 0 -> {}\n" +
" default -> {}\n" +
" } \n" +
" }\n" +
@@ -2814,7 +2833,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"}",
},
"java.lang.NullPointerException\n" +
- " at java.base/java.util.Objects.requireNonNull(Objects.java:208)\n" +
+ " at java.base/java.util.Objects.requireNonNull(Objects.java:233)\n" +
" at X.foo(X.java:3)\n" +
" at X.main(X.java:10)");
}
@@ -2840,7 +2859,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"",
"java.lang.NullPointerException\n" +
- " at java.base/java.util.Objects.requireNonNull(Objects.java:208)\n" +
+ " at java.base/java.util.Objects.requireNonNull(Objects.java:233)\n" +
" at X.foo(X.java:3)\n" +
" at X.main(X.java:10)");
}
@@ -2862,14 +2881,14 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"0");
}
- public void testBug575249_02() {
+ public void _testBug575249_02() {
runConformTest(
new String[] {
"X.java",
"public class X {\n" +
" public static int foo(Object o) {\n" +
" return switch (o) {\n" +
- " case (String s && s.length() < 10) : yield 0;\n" +
+ " case (String s when s.length() < 10) : yield 0;\n" +
" default : yield 1;\n" +
" };\n" +
" }\n" +
@@ -2898,7 +2917,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"0");
}
- public void testBug575249_04() {
+ public void _testBug575249_04() {
runConformTest(
new String[] {
"X.java",
@@ -3390,7 +3409,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" static int foo(String o) {\n"+
" return switch (o) {\n" +
- " case String s && s.length() > 0 -> 3;\n" +
+ " case String s when s.length() > 0 -> 3;\n" +
" case String s1 -> 1;\n" +
" case String s -> -1;\n"+
" };\n"+
@@ -3401,7 +3420,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 6)\n" +
" case String s -> -1;\n" +
" ^^^^^^^^\n" +
- "The switch statement cannot have more than one total pattern\n" +
+ "The switch statement cannot have more than one unconditional pattern\n" +
"----------\n" +
"2. ERROR in X.java (at line 6)\n" +
" case String s -> -1;\n" +
@@ -3480,8 +3499,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" static String foo(Object o) {\n" +
" return switch (o) {\n" +
- " case String i && i.length() == 0 -> \"empty\";\n" +
- " case String i && i.length() > 0 -> \"zero+\";\n" +
+ " case String i when i.length() == 0 -> \"empty\";\n" +
+ " case String i when i.length() > 0 -> \"zero+\";\n" +
" case Color s -> s.toString();\n" +
" default -> \"unknown\";\n" +
" };\n" +
@@ -3534,7 +3553,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" static String foo(Color o) {\n" +
" return switch (o) {\n" +
" case Red -> \"Red\";\n" +
- " case Color s && s == Color.Blue -> s.toString();\n" +
+ " case Color s when s == Color.Blue -> s.toString();\n" +
" case Color s -> s.toString();\n" +
" };\n" +
" }\n" +
@@ -3557,7 +3576,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" static String foo(Color o) {\n" +
" return switch (o) {\n" +
- " case Color s && s == Color.Blue -> s.toString();\n" +
+ " case Color s when s == Color.Blue -> s.toString();\n" +
" case Red -> \"Red\";\n" +
" case null -> \"\";\n" +
" };\n" +
@@ -3586,7 +3605,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" static String foo(Color o) {\n" +
" return switch (o) {\n" +
- " case Color s && s == Color.Blue -> s.toString();\n" +
+ " case Color s when s == Color.Blue -> s.toString();\n" +
" case Red -> \"Red\";\n" +
" };\n" +
" }\n" +
@@ -3615,7 +3634,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" static void foo(Integer o) {\n" +
" switch (o) {\n" +
" case 1: break;\n" +
- " case Integer s && s == 2:\n" +
+ " case Integer s when s == 2:\n" +
" System.out.println(s);break;\n" +
" case null, default:\n" +
" System.out.println(\"null/default\");\n" +
@@ -3652,7 +3671,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"+
" public int foo(CharSequence c) {\n" +
" return switch (c) {\n" +
- " case CharSequence c1 && (c instanceof String c1 && c1.length() > 0) -> 0;\n" +
+ " case CharSequence c1 when (c instanceof String c1 && c1.length() > 0) -> 0;\n" +
" default -> 0;\n" +
" };\n" +
" }" +
@@ -3660,8 +3679,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 4)\n" +
- " case CharSequence c1 && (c instanceof String c1 && c1.length() > 0) -> 0;\n" +
- " ^^\n" +
+ " case CharSequence c1 when (c instanceof String c1 && c1.length() > 0) -> 0;\n" +
+ " ^^\n" +
"Duplicate local variable c1\n" +
"----------\n");
}
@@ -3690,7 +3709,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"}",
},
"java.lang.NullPointerException\n"
- + " at java.base/java.util.Objects.requireNonNull(Objects.java:208)\n"
+ + " at java.base/java.util.Objects.requireNonNull(Objects.java:233)\n"
+ " at X.foo(X.java:4)\n"
+ " at X.main(X.java:15)");
}
@@ -4333,7 +4352,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" @SuppressWarnings(\"preview\")\n"+
" static int foo(Object o) {\n"+
" return switch (o) { \n"+
- " case X x && true -> 0;\n"+
+ " case X x when true -> 0;\n"+
" default -> 1;\n"+
" }; \n"+
" } \n"+
@@ -4355,7 +4374,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" public static void main(String[] args) {\n"+
" Boolean input = false;\n"+
" int result = switch(input) {\n"+
- " case Boolean p && true -> 1;\n"+
+ " case Boolean p when true -> 1;\n"+
" };\n"+
" System.out.println(result);\n"+
" }\n"+
@@ -4423,7 +4442,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"2");
}
// to be enabled after bug 578417 is fixed.
- public void _testBug578402_3() {
+ public void testBug578402_3() {
runConformTest(
new String[] {
"X.java",
@@ -4458,7 +4477,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"
+ " public static void foo(Object obj, int x) {\n"
+ " switch (obj) {\n"
- + " case String s && (switch (x) {\n"
+ + " case String s when (switch (x) {\n"
+ " case 1 -> { yield true; }\n"
+ " default -> { yield false; }\n"
+ " }) \n"
@@ -4499,7 +4518,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " }\n"
+ "}";
}
- public void testBug578504_1() {
+ public void _testBug578504_1() {
runConformTest(
new String[] {
"X.java",
@@ -4508,7 +4527,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"true");
}
- public void testBug578504_2() {
+ public void _testBug578504_2() {
runConformTest(
new String[] {
"X.java",
@@ -4516,7 +4535,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"false");
}
- public void testBug578504_3() {
+ public void _testBug578504_3() {
runConformTest(
new String[] {
"X.java",
@@ -4524,7 +4543,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"true");
}
- public void testBug578504_4() {
+ public void _testBug578504_4() {
runNegativeTest(
new String[] {
"X.java",
@@ -4537,7 +4556,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"ss cannot be resolved to a variable\n" +
"----------\n");
}
- public void testBug578504_5() {
+ public void _testBug578504_5() {
runNegativeTest(
new String[] {
"X.java",
@@ -4550,7 +4569,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"ss cannot be resolved to a variable\n" +
"----------\n");
}
- public void testBug578504_6() {
+ public void _testBug578504_6() {
runConformTest(
new String[] {
"X.java",
@@ -4558,7 +4577,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"true");
}
- public void testBug578504_7() {
+ public void _testBug578504_7() {
runConformTest(
new String[] {
"X.java",
@@ -4574,7 +4593,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " @SuppressWarnings(\"preview\")\n"
+ " static Long foo(Number n) {\n"
+ " return switch (n) {\n"
- + " case (Long l) && l.toString().equals(\"0\") -> {\n"
+ + " case (Long l) when l.toString().equals(\"0\") -> {\n"
+ " yield ++l;\n"
+ " }\n"
+ " default -> throw new IllegalArgumentException();\n"
@@ -4595,9 +4614,9 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " @SuppressWarnings(\"preview\")\n"
+ " static Long foo(Number n) { \n"
+ " return switch (n) { \n"
- + " case (Long l) && l.toString().equals(\"0\") -> {\n"
+ + " case (Long l) when l.toString().equals(\"0\") -> {\n"
+ " yield switch(l) {\n"
- + " case Long l1 && l1.toString().equals(l1.toString()) -> {\n"
+ + " case Long l1 when l1.toString().equals(l1.toString()) -> {\n"
+ " yield ++l + ++l1;\n"
+ " }\n"
+ " default -> throw new IllegalArgumentException(\"Unexpected value: \" + l);\n"
@@ -4621,9 +4640,9 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " @SuppressWarnings(\"preview\")\n"
+ " static Long foo(Number n) { \n"
+ " return switch (n) { \n"
- + " case (Long l) && l.toString().equals(\"0\") -> {\n"
+ + " case (Long l) when l.toString().equals(\"0\") -> {\n"
+ " yield switch(l) {\n"
- + " case Long l1 && l.toString().equals(l1.toString()) -> {\n"
+ + " case Long l1 when l.toString().equals(l1.toString()) -> {\n"
+ " yield ++l + ++l1;\n"
+ " }\n"
+ " default -> throw new IllegalArgumentException(\"Unexpected value: \" + l);\n"
@@ -4636,8 +4655,8 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
},
"----------\n" +
"1. ERROR in X.java (at line 7)\n" +
- " case Long l1 && l.toString().equals(l1.toString()) -> {\n" +
- " ^\n" +
+ " case Long l1 when l.toString().equals(l1.toString()) -> {\n" +
+ " ^\n" +
"Local variable l referenced from a guard must be final or effectively final\n" +
"----------\n");
}
@@ -4650,7 +4669,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " static Long foo(Number n) { \n"
+ " int i = 0;\n"
+ " return switch(n) {\n"
- + " case Long l && (1 == switch(l) {\n"
+ + " case Long l when (1 == switch(l) {\n"
+ " case \n"
+ " default -> { \n"
+ " yield (i++);\n"
@@ -4677,7 +4696,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " static Long foo(Number n) { \n"
+ " int i = 0;\n"
+ " return switch(n) {\n"
- + " case Long l && (1 == switch(l) {\n"
+ + " case Long l when (1 == switch(l) {\n"
+ " case \n"
+ " default -> { \n"
+ " yield ++i;\n"
@@ -4704,7 +4723,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " static Long foo(Number n) { \n"
+ " int i = 0;\n"
+ " return switch(n) {\n"
- + " case Long l && (1 == switch(l) {\n"
+ + " case Long l when (1 == switch(l) {\n"
+ " case \n"
+ " default -> { \n"
+ " yield (i=i+1);\n"
@@ -4732,7 +4751,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " static Long foo(Number n) { \n"
+ " int i = 0;\n"
+ " return switch(n) {\n"
- + " case Long l && (1 == switch(l) {\n"
+ + " case Long l when (1 == switch(l) {\n"
+ " case \n"
+ " default -> { \n"
+ " yield (i = bar());\n"
@@ -4835,7 +4854,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"
+ " public static int testMethod(I i) {\n"
+ " return switch (i) {\n"
- + " case I p1 && (p1 instanceof C p2) : {\n"
+ + " case I p1 when (p1 instanceof C p2) : {\n"
+ " yield p2.value(); // Error here\n"
+ " }\n"
+ " case I p3 : {\n"
@@ -4871,7 +4890,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"
+ " public static int testMethod(I i) {\n"
+ " return switch (i) {\n"
- + " case I p1 && (p1 instanceof C p2) : {\n"
+ + " case I p1 when (p1 instanceof C p2) : {\n"
+ " yield p2.value();\n"
+ " }\n"
+ " case I p3 : {\n"
@@ -4907,7 +4926,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"
+ " public static int foo(Object o) {\n"
+ " return switch (o) {\n"
- + " case Number n && (n instanceof Integer i) : {\n"
+ + " case Number n when (n instanceof Integer i) : {\n"
+ " yield n.intValue() + i; // Error here\n"
+ " }\n"
+ " case Number n2 : {\n"
@@ -4936,7 +4955,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"public class X {\n"
+ " public static int foo(Object o) {\n"
+ " return switch (o) {\n"
- + " case Number n && (n instanceof Integer i && i.equals(10)) : {\n"
+ + " case Number n when (n instanceof Integer i && i.equals(10)) : {\n"
+ " yield n.intValue() + i; // Error here\n"
+ " }\n"
+ " case Number n2 : {\n"
@@ -4966,7 +4985,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " @SuppressWarnings({ \"preview\", \"rawtypes\" })\n"
+ " public static boolean foo(Integer n) {\n"
+ " return switch (n) {\n"
- + " case Integer x && x.equals(10) -> {\n"
+ + " case Integer x when x.equals(10) -> {\n"
+ " yield true;\n"
+ " }\n"
+ " case Comparable y -> {\n"
@@ -4989,7 +5008,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " @SuppressWarnings({ \"preview\", \"rawtypes\" })\n"
+ " public static boolean foo(Integer n) {\n"
+ " return switch (n) {\n"
- + " case Integer x && x.equals(10) -> {\n"
+ + " case Integer x when x.equals(10) -> {\n"
+ " yield true;\n"
+ " }\n"
+ " case Comparable y -> {\n"
@@ -5009,7 +5028,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 11)\n" +
" default -> {\n" +
" ^^^^^^^\n" +
- "Switch case cannot have both a total pattern and default label\n" +
+ "Switch case cannot have both unconditional pattern and default label\n" +
"----------\n");
}
public void testBug578635_3() {
@@ -5019,7 +5038,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
+ " @SuppressWarnings({ \"preview\", \"rawtypes\" })\n"
+ " public static boolean foo(Integer n) {\n"
+ " return switch (n) {\n"
- + " case Integer x && x.equals(10) -> {\n"
+ + " case Integer x when x.equals(10) -> {\n"
+ " yield true;\n"
+ " }\n"
+ " case Comparable y -> {\n"
@@ -5039,7 +5058,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
"1. ERROR in X.java (at line 11)\n" +
" default -> {\n" +
" ^^^^^^^\n" +
- "Switch case cannot have both a total pattern and default label\n" +
+ "Switch case cannot have both unconditional pattern and default label\n" +
"----------\n");
}
public void testBug578417_1() {
@@ -5077,7 +5096,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" @SuppressWarnings(\"preview\")\n"+
" static int foo(Object o, boolean b) {\n"+
" return switch (o) { \n"+
- " case X x && b -> 0; // compilation error\n"+
+ " case X x when b -> 0; // compilation error\n"+
" default -> 1;\n"+
" }; \n"+
" } \n"+
@@ -5148,7 +5167,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" static void constantLabelMustAppearBeforePattern(Integer o) {\n"+
" switch (o) {\n"+
" case -1, 1 -> System.out.println(\"special case:\" + o);\n"+
- " case Integer i && i > 0 -> System.out.println(\"positive integer: \" + o);\n"+
+ " case Integer i when i > 0 -> System.out.println(\"positive integer: \" + o);\n"+
" case Integer i -> System.out.println(\"other integer: \" + o);\n"+
" }\n"+
" }\n"+
@@ -5177,7 +5196,7 @@ public class SwitchPatternTest extends AbstractRegressionTest9 {
" switch (o) {\n"+
" case -1, 1 -> System.out.println(\"special case:\" + o);\n"+
" case null -> System.out.println(\"null\");\n"+
- " case Integer i && i > 0 -> System.out.println(\"positive integer: \" + o);\n"+
+ " case Integer i when i > 0 -> System.out.println(\"positive integer: \" + o);\n"+
" case Integer i -> System.out.println(\"other integer: \" + o);\n"+
" }\n"+
" }\n"+
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
index 29c8692b1..4445a9858 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
@@ -230,10 +230,14 @@ public static Test suite() {
// add 18 specific test here (check duplicates)
ArrayList since_18 = new ArrayList();
- since_18.add(SwitchPatternTest.class);
- since_18.add(NullAnnotationTests18.class);
since_18.add(JavadocTest_18.class);
+ // add 19 specific test here (check duplicates)
+ ArrayList since_19 = new ArrayList();
+ since_19.add(NullAnnotationTests18.class);
+ since_19.add(SwitchPatternTest.class);
+ since_19.add(RecordPatternTest.class);
+
// Build final test suite
TestSuite all = new TestSuite(TestAll.class.getName());
all.addTest(new TestSuite(StandAloneASTParserTest.class));
@@ -452,6 +456,27 @@ public static Test suite() {
TestCase.resetForgottenFilters(tests_18);
all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_18), tests_18));
}
+ if ((possibleComplianceLevels & AbstractCompilerTest.F_19) != 0) {
+ ArrayList tests_19 = (ArrayList)standardTests.clone();
+ tests_19.addAll(since_1_4);
+ tests_19.addAll(since_1_5);
+ tests_19.addAll(since_1_6);
+ tests_19.addAll(since_1_7);
+ tests_19.addAll(since_1_8);
+ tests_19.addAll(since_9);
+ tests_19.addAll(since_10);
+ tests_19.addAll(since_11);
+ tests_19.addAll(since_12);
+ tests_19.addAll(since_13);
+ tests_19.addAll(since_14);
+ tests_19.addAll(since_15);
+ tests_19.addAll(since_16);
+ tests_19.addAll(since_17);
+ tests_19.addAll(since_18);
+ tests_19.addAll(since_19);
+ TestCase.resetForgottenFilters(tests_19);
+ all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_19), tests_19));
+ }
all.addTest(new TestSuite(Jsr14Test.class));
return all;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedModuleTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedModuleTest.java
index ce530f0fe..26d164be8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedModuleTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedModuleTest.java
@@ -13,6 +13,11 @@
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
+import java.io.File;
+import java.util.Map;
+
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
+
import junit.framework.Test;
public class UnnamedModuleTest extends AbstractRegressionTest9 {
@@ -66,4 +71,141 @@ public void testBug522326() {
}
);
}
+
+// https://github.com/eclipse-jdt/eclipse.jdt.core/issues/415
+// Should compile successfully when the compilation unit contains a split package and
+// the option 'OPTION_IgnoreUnnamedModuleForSplitPackage' is turned on.
+public void testIgnoreUnnamedModule1() {
+ String path = this.getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "ignore-unnamed-module-test.jar";
+ String[] defaultLibs = getDefaultClassPaths();
+ int len = defaultLibs.length;
+ String[] libs = new String[len+1];
+ System.arraycopy(defaultLibs, 0, libs, 0, len);
+ libs[len] = path;
+ Map<String, String> compilerOptions = getCompilerOptions();
+ compilerOptions.put(CompilerOptions.OPTION_IgnoreUnnamedModuleForSplitPackage, CompilerOptions.ENABLED);
+ this.runConformTest(
+ true,
+ new String[] {
+ "X.java",
+ "import org.xml.sax.SAXException;\n" +
+ "public class X {\n" +
+ " void foo() {\n" +
+ " SAXException s;\n" +
+ " }\n" +
+ "}"
+ },
+ libs,
+ compilerOptions,
+ "",
+ "",
+ "",
+ JavacTestOptions.DEFAULT);
+}
+public void testIgnoreUnnamedModule2() {
+ String path = this.getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "ignore-unnamed-module-test.jar";
+ String[] defaultLibs = getDefaultClassPaths();
+ int len = defaultLibs.length;
+ String[] libs = new String[len+1];
+ System.arraycopy(defaultLibs, 0, libs, 0, len);
+ libs[len] = path;
+ Map<String, String> compilerOptions = getCompilerOptions();
+ compilerOptions.put(CompilerOptions.OPTION_IgnoreUnnamedModuleForSplitPackage, CompilerOptions.ENABLED);
+ this.runConformTest(
+ true,
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void foo() {\n" +
+ " org.xml.sax.SAXException s;\n" +
+ " }\n" +
+ "}"
+ },
+ libs,
+ compilerOptions,
+ "",
+ "",
+ "",
+ JavacTestOptions.DEFAULT);
+}
+public void testIgnoreUnnamedModule3() {
+ String path = this.getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "ignore-unnamed-module-test.jar";
+ String[] defaultLibs = getDefaultClassPaths();
+ int len = defaultLibs.length;
+ String[] libs = new String[len+1];
+ System.arraycopy(defaultLibs, 0, libs, 0, len);
+ libs[len] = path;
+ Map<String, String> compilerOptions = getCompilerOptions();
+ compilerOptions.put(CompilerOptions.OPTION_IgnoreUnnamedModuleForSplitPackage, CompilerOptions.ENABLED);
+ this.runConformTest(
+ true,
+ new String[] {
+ "X.java",
+ "import static org.xml.sax.helpers.NamespaceSupport.XMLNS;\n" +
+ "public class X {\n" +
+ " void foo() {\n" +
+ " String s = XMLNS;\n" +
+ " }\n" +
+ "}"
+ },
+ libs,
+ compilerOptions,
+ "",
+ "",
+ "",
+ JavacTestOptions.DEFAULT);
+}
+public void testIgnoreUnnamedModule4() {
+ String path = this.getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "ignore-unnamed-module-test.jar";
+ String[] defaultLibs = getDefaultClassPaths();
+ int len = defaultLibs.length;
+ String[] libs = new String[len+1];
+ System.arraycopy(defaultLibs, 0, libs, 0, len);
+ libs[len] = path;
+ Map<String, String> compilerOptions = getCompilerOptions();
+ compilerOptions.put(CompilerOptions.OPTION_IgnoreUnnamedModuleForSplitPackage, CompilerOptions.ENABLED);
+ this.runConformTest(
+ true,
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void foo() {\n" +
+ " String s = org.xml.sax.helpers.NamespaceSupport.XMLNS;\n" +
+ " }\n" +
+ "}"
+ },
+ libs,
+ compilerOptions,
+ "",
+ "",
+ "",
+ JavacTestOptions.DEFAULT);
+}
+public void testConflictWithUnnamedModule() {
+ String path = this.getCompilerTestsPluginDirectoryPath() + File.separator + "workspace" + File.separator + "ignore-unnamed-module-test.jar";
+ String[] defaultLibs = getDefaultClassPaths();
+ int len = defaultLibs.length;
+ String[] libs = new String[len+1];
+ System.arraycopy(defaultLibs, 0, libs, 0, len);
+ libs[len] = path;
+ Runner runner = new Runner();
+ runner.classLibraries = libs;
+ runner.testFiles =
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " void foo() {\n" +
+ " String s = org.xml.sax.helpers.NamespaceSupport.XMLNS;\n" +
+ " }\n" +
+ "}"
+ };
+ runner.expectedErrorString =
+ "----------\n" +
+ "1. ERROR in X.java (at line 3)\n" +
+ " String s = org.xml.sax.helpers.NamespaceSupport.XMLNS;\n" +
+ " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" +
+ "The package org.xml.sax.helpers is accessible from more than one module: <unnamed>, java.xml\n" +
+ "----------\n";
+ runner.runNegativeTest();
+}
}
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
index 962e6fd68..a5117cdd2 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java
@@ -50,6 +50,7 @@ public class AbstractCompilerTest extends TestCase {
public static final int F_16 = 0x2000;
public static final int F_17 = 0x4000;
public static final int F_18 = 0x8000;
+ public static final int F_19 = 0x10000;
public static final boolean RUN_JAVAC = CompilerOptions.ENABLED.equals(System.getProperty("run.javac"));
public static final boolean PERFORMANCE_ASSERTS = !CompilerOptions.DISABLED.equals(System.getProperty("jdt.performance.asserts"));
@@ -70,6 +71,7 @@ public class AbstractCompilerTest extends TestCase {
protected static boolean isJRE16Plus = false;
protected static boolean isJRE17Plus = false;
protected static boolean isJRE18Plus = false;
+ protected static boolean isJRE19Plus = false;
protected static boolean reflectNestedClassUseDollar;
public static int[][] complianceTestLevelMapping = new int[][] {
@@ -89,6 +91,7 @@ public class AbstractCompilerTest extends TestCase {
new int[] {F_16, ClassFileConstants.MAJOR_VERSION_16},
new int[] {F_17, ClassFileConstants.MAJOR_VERSION_17},
new int[] {F_18, ClassFileConstants.MAJOR_VERSION_18},
+ new int[] {F_19, ClassFileConstants.MAJOR_VERSION_19},
};
/**
@@ -318,8 +321,9 @@ public class AbstractCompilerTest extends TestCase {
public static int getPossibleComplianceLevels() {
if (possibleComplianceLevels == UNINITIALIZED) {
String specVersion = System.getProperty("java.specification.version");
- isJRE18Plus = CompilerOptions.VERSION_18.equals(specVersion);
- isJRE17Plus = isJRE18Plus || CompilerOptions.VERSION_17.equals(specVersion);
+ isJRE19Plus = CompilerOptions.VERSION_19.equals(specVersion);
+ isJRE18Plus = isJRE19Plus || CompilerOptions.VERSION_18.equals(specVersion);
+ isJRE17Plus = isJRE18Plus || CompilerOptions.VERSION_17.equals(specVersion);
isJRE16Plus = isJRE17Plus || CompilerOptions.VERSION_16.equals(specVersion);
isJRE15Plus = isJRE16Plus || CompilerOptions.VERSION_15.equals(specVersion);
isJRE14Plus = isJRE15Plus || CompilerOptions.VERSION_14.equals(specVersion);
@@ -379,6 +383,9 @@ public class AbstractCompilerTest extends TestCase {
} else if (CompilerOptions.VERSION_18.equals(compliance)) {
if (isJRE18Plus)
possibleComplianceLevels |= F_18;
+ } else if (CompilerOptions.VERSION_19.equals(compliance)) {
+ if (isJRE19Plus)
+ possibleComplianceLevels |= F_19;
} else {
System.out.println("Ignoring invalid compliance (" + compliance + ")");
System.out.print("Use one of ");
@@ -398,7 +405,8 @@ public class AbstractCompilerTest extends TestCase {
System.out.println(CompilerOptions.VERSION_15 + ", ");
System.out.println(CompilerOptions.VERSION_16 + ", ");
System.out.println(CompilerOptions.VERSION_17 + ", ");
- System.out.println(CompilerOptions.VERSION_18);
+ System.out.println(CompilerOptions.VERSION_18 + ", ");
+ System.out.println(CompilerOptions.VERSION_19);
}
}
if (possibleComplianceLevels == 0) {
@@ -472,6 +480,10 @@ public class AbstractCompilerTest extends TestCase {
if (canRun18) {
possibleComplianceLevels |= F_18;
}
+ boolean canRun19 = canRun18 && !CompilerOptions.VERSION_18.equals(specVersion);
+ if (canRun19) {
+ possibleComplianceLevels |= F_19;
+ }
} else if ("1.0".equals(specVersion)
|| CompilerOptions.VERSION_1_1.equals(specVersion)
|| CompilerOptions.VERSION_1_2.equals(specVersion)
@@ -506,6 +518,9 @@ public class AbstractCompilerTest extends TestCase {
possibleComplianceLevels |= F_17;
if (!CompilerOptions.VERSION_17.equals(specVersion)) {
possibleComplianceLevels |= F_18;
+ if (!CompilerOptions.VERSION_18.equals(specVersion)) {
+ possibleComplianceLevels |= F_19;
+ }
}
}
}
@@ -696,7 +711,7 @@ public class AbstractCompilerTest extends TestCase {
int major = Integer.parseInt(ver) + ClassFileConstants.MAJOR_VERSION_0;
return "version " + ver + " : " + major + ".0";
}
- if (compliance >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_18)) return version; // keep this stmt for search for next bump up
+ if (compliance >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_19)) return version; // keep this stmt for search for next bump up
return version;
}
diff --git a/org.eclipse.jdt.core.tests.compiler/workspace/ignore-unnamed-module-test.jar b/org.eclipse.jdt.core.tests.compiler/workspace/ignore-unnamed-module-test.jar
new file mode 100644
index 000000000..457e48e24
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/workspace/ignore-unnamed-module-test.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.compiler/workspace/lib576735.jar b/org.eclipse.jdt.core.tests.compiler/workspace/lib576735.jar
new file mode 100644
index 000000000..b5b4adac2
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/workspace/lib576735.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/build.xml b/org.eclipse.jdt.core.tests.model/JCL/build.xml
index 0099d07b3..1e554b3b2 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/build.xml
+++ b/org.eclipse.jdt.core.tests.model/JCL/build.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2020, 2021 GK Software SE and others.
+ Copyright (c) 2020, 2022 GK Software SE and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
@@ -60,12 +60,20 @@
<param name="suffix" value="14"/>
</antcall>
<antcall target="converterJclMin">
+ <param name="compliance" value="15"/>
+ <param name="suffix" value="15"/>
+ </antcall>
+ <antcall target="converterJclMin">
<param name="compliance" value="17"/>
<param name="suffix" value="17"/>
</antcall>
<antcall target="converterJclMin">
- <param name="compliance" value="15"/>
- <param name="suffix" value="15"/>
+ <param name="compliance" value="18"/>
+ <param name="suffix" value="18"/>
+ </antcall>
+ <antcall target="converterJclMin">
+ <param name="compliance" value="19"/>
+ <param name="suffix" value="19"/>
</antcall>
</target>
<target name="converterJclMin">
@@ -74,7 +82,7 @@
debuglevel="lines,source"
source="${compliance}"
target="${compliance}">
- <compilerarg line="-Xlint:none"/>
+ <compilerarg line="-Xlint:none --limit-modules=java.base"/>
</javac>
<jar destfile="${basedir}/converterJclMin${suffix}.jar" basedir="${jclbase}/converterJclMin${suffix}/bin"/>
<zip destfile="${basedir}/converterJclMin${suffix}src.zip">
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
index b68bd853c..5f3f1281f 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.7.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
index 5d256338f..ea8f667ff 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin1.8.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
index 9ef6dfd16..5331e7aea 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin10.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
index 8796dd91f..292836eba 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin11.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
index 56e0019a2..b224bfec3 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin12.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
index f9619b9fa..0eca4e09d 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin13.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar
index edfd11d34..a7d61953e 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin14.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar
index e4f6c635e..0fab9a0e7 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip
index 6876082bb..1ecc25347 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin15src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17.jar
index 539375b1c..e1ed966e6 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17src.zip
index 8674e8341..6463c8b2d 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17src.zip
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin17src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin18.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin18.jar
new file mode 100644
index 000000000..fcc35e049
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin18.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin18src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin18src.zip
new file mode 100644
index 000000000..f8ed94d97
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin18src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin19.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin19.jar
new file mode 100644
index 000000000..033deeca3
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin19.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin19src.zip b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin19src.zip
new file mode 100644
index 000000000..6dda61699
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin19src.zip
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
index b968f8aa0..a59d6c687 100644
--- a/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
+++ b/org.eclipse.jdt.core.tests.model/JCL/converterJclMin9.jar
Binary files differ
diff --git a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
index c2c37125a..dbb452b27 100644
--- a/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core.tests.model;singleton:=true
-Bundle-Version: 3.11.300.qualifier
+Bundle-Version: 3.11.400.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.jdt.core.tests,
diff --git a/org.eclipse.jdt.core.tests.model/pom.xml b/org.eclipse.jdt.core.tests.model/pom.xml
index ad4dc39c4..a0c110f9b 100644
--- a/org.eclipse.jdt.core.tests.model/pom.xml
+++ b/org.eclipse.jdt.core.tests.model/pom.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Copyright (c) 2012, 2021 Eclipse Foundation and others.
+ Copyright (c) 2012, 2022 Eclipse Foundation and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Distribution License v1.0
which accompanies this distribution, and is available at
@@ -15,11 +15,11 @@
<parent>
<artifactId>tests-pom</artifactId>
<groupId>org.eclipse.jdt</groupId>
- <version>4.25.0-SNAPSHOT</version>
+ <version>4.26.0-SNAPSHOT</version>
<relativePath>../tests-pom/</relativePath>
</parent>
<artifactId>org.eclipse.jdt.core.tests.model</artifactId>
- <version>3.11.300-SNAPSHOT</version>
+ <version>3.11.400-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
@@ -212,15 +212,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>toolchain</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<toolchains>
<jdk>
@@ -242,15 +233,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>toolchain</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<toolchains>
<jdk>
@@ -272,15 +254,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>toolchain</goal>
- </goals>
- </execution>
- </executions>
<configuration>
<toolchains>
<jdk>
@@ -295,6 +268,27 @@
<tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,15,18</tycho.surefire.argLine>
</properties>
</profile>
+ <profile>
+ <id>test-on-javase-19</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-toolchains-plugin</artifactId>
+ <configuration>
+ <toolchains>
+ <jdk>
+ <id>JavaSE-19</id>
+ </jdk>
+ </toolchains>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <properties>
+ <tycho.surefire.argLine>--add-modules ALL-SYSTEM -Dcompliance=1.4,1.7,1.8,17,19</tycho.surefire.argLine>
+ </properties>
+ </profile>
</profiles>
</project>
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava19Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava19Tests.java
new file mode 100644
index 000000000..2737a1d55
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/RunOnlyJava19Tests.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import org.eclipse.jdt.core.tests.compiler.regression.NullAnnotationTests18;
+import org.eclipse.jdt.core.tests.compiler.regression.RecordPatternTest;
+import org.eclipse.jdt.core.tests.compiler.regression.SwitchPatternTest;
+import org.eclipse.jdt.core.tests.dom.ConverterTestSetup;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+@SuppressWarnings({"rawtypes", "unchecked"})
+public class RunOnlyJava19Tests extends TestCase {
+
+ public RunOnlyJava19Tests(String name) {
+ super(name);
+ }
+ public static Class[] getAllTestClasses() {
+ return new Class[] {
+ RecordPatternTest.class,
+ NullAnnotationTests18.class,
+ SwitchPatternTest.class
+ };
+ }
+
+ public static Class[] getConverterTestClasses() {
+ return new Class[] {
+ };
+ }
+ public static Test suite() {
+ TestSuite ts = new TestSuite(RunOnlyJava19Tests.class.getName());
+
+ Class[] testClasses = getAllTestClasses();
+ addTestsToSuite(ts, testClasses);
+ testClasses = getConverterTestClasses();
+ ConverterTestSetup.TEST_SUITES = new ArrayList(Arrays.asList(testClasses));
+ addTestsToSuite(ts, testClasses);
+ return ts;
+ }
+ public static void addTestsToSuite(TestSuite suite, Class[] testClasses) {
+
+ for (int i = 0; i < testClasses.length; i++) {
+ Class testClass = testClasses[i];
+ // call the suite() method and add the resulting suite to the suite
+ try {
+ Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
+ Test test = (Test)suiteMethod.invoke(null, new Object[0]);
+ suite.addTest(test);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.getTargetException().printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ protected void tearDown() throws Exception {
+ ConverterTestSetup.PROJECT_SETUP = false;
+ super.tearDown();
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS4Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS4Test.java
index cfcb151f2..bb24239e3 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS4Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS4Test.java
@@ -7744,7 +7744,7 @@ public class ASTConverter15JLS4Test extends ConverterTestSetup {
assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
CompilationUnit unit = (CompilationUnit) node;
String expectedProblems = "The hierarchy of the type X is inconsistent\n" +
- "The type test0235.Zork cannot be resolved. It is indirectly referenced from required .class files";
+ "The type test0235.Zork cannot be resolved. It is indirectly referenced from required type test0235.I";
assertProblemsSize(unit, 2, expectedProblems);
node = getASTNode(unit, 0);
assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS8Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS8Test.java
index 57c9f79da..32ae38f6b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS8Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15JLS8Test.java
@@ -7732,7 +7732,7 @@ public class ASTConverter15JLS8Test extends ConverterTestSetup {
assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
CompilationUnit unit = (CompilationUnit) node;
String expectedProblems = "The hierarchy of the type X is inconsistent\n" +
- "The type test0235.Zork cannot be resolved. It is indirectly referenced from required .class files";
+ "The type test0235.Zork cannot be resolved. It is indirectly referenced from required type test0235.I";
assertProblemsSize(unit, 2, expectedProblems);
node = getASTNode(unit, 0);
assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java
index d81c4bf6c..5edc265e7 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java
@@ -7755,7 +7755,7 @@ public class ASTConverter15Test extends ConverterTestSetup {
assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
CompilationUnit unit = (CompilationUnit) node;
String expectedProblems = "The hierarchy of the type X is inconsistent\n" +
- "The type test0235.Zork cannot be resolved. It is indirectly referenced from required .class files";
+ "The type test0235.Zork cannot be resolved. It is indirectly referenced from required type test0235.I";
assertProblemsSize(unit, 2, expectedProblems);
node = getASTNode(unit, 0);
assertEquals("Not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java
index b2e04b2d2..b4405c540 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST3_2.java
@@ -6120,7 +6120,7 @@ public class ASTConverterTestAST3_2 extends ConverterTestSetup {
CompilationUnit compilationUnit = (CompilationUnit) node;
String expectedResult =
"The hierarchy of the type X is inconsistent\n" +
- "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required .class files";
+ "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required type test0599.Zork";
assertProblemsSize(compilationUnit, 2, expectedResult);
compilationUnit.accept(new ASTVisitor() {
public void endVisit(MethodDeclaration methodDeclaration) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java
index 16ced3bfc..db095e57e 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST4_2.java
@@ -6117,7 +6117,7 @@ public class ASTConverterTestAST4_2 extends ConverterTestSetup {
CompilationUnit compilationUnit = (CompilationUnit) node;
String expectedResult =
"The hierarchy of the type X is inconsistent\n" +
- "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required .class files";
+ "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required type test0599.Zork";
assertProblemsSize(compilationUnit, 2, expectedResult);
compilationUnit.accept(new ASTVisitor() {
public void endVisit(MethodDeclaration methodDeclaration) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST8_2.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST8_2.java
index 7e5205208..c6713cbab 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST8_2.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverterTestAST8_2.java
@@ -6147,7 +6147,7 @@ public class ASTConverterTestAST8_2 extends ConverterTestSetup {
CompilationUnit compilationUnit = (CompilationUnit) node;
String expectedResult =
"The hierarchy of the type X is inconsistent\n" +
- "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required .class files";
+ "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required type test0599.Zork";
assertProblemsSize(compilationUnit, 2, expectedResult);
compilationUnit.accept(new ASTVisitor() {
public void endVisit(MethodDeclaration methodDeclaration) {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_GuardedPattern_Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_GuardedPattern_Test.java
new file mode 100644
index 000000000..d404776f3
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_GuardedPattern_Test.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.dom;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.GuardedPattern;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SwitchCase;
+import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+
+import junit.framework.Test;
+
+public class ASTConverter_GuardedPattern_Test extends ConverterTestSetup {
+
+ ICompilationUnit workingCopy;
+
+ public void setUpSuite() throws Exception {
+ super.setUpSuite();
+ this.ast = AST.newAST(getAST19(), true);
+ this.currentProject = getJavaProject("Converter_19");
+ if (this.ast.apiLevel() == AST.JLS19 ) {
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+ }
+ }
+
+ public ASTConverter_GuardedPattern_Test(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return buildModelTestSuite(ASTConverter_GuardedPattern_Test.class);
+ }
+
+ static int getAST19() {
+ return AST.JLS19;
+ }
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (this.workingCopy != null) {
+ this.workingCopy.discardWorkingCopy();
+ this.workingCopy = null;
+ }
+ }
+
+
+ public void testGuardedPattern001() throws CoreException {
+ if (!isJRE19) {
+ System.err.println("Test "+getName()+" requires a JRE 19");
+ return;
+ }
+ String contents = "" +
+ "public class X {\n" +
+ "\n" +
+ " interface Shape {\n" +
+ " public double calculateArea();\n" +
+ " }\n" +
+ " \n" +
+ " record Triangle(double base, double height) implements Shape {\n" +
+ " public double calculateArea() {\n" +
+ " return (0.5 * base * height);\n" +
+ " }\n" +
+ " }\n" +
+ " \n" +
+ " public static void main(String[] args) {\n" +
+ " Shape s= new Triangle(10, 10);\n" +
+ " testTriangle(s);\n" +
+ " s= new Triangle(10, 100);\n" +
+ " testTriangle(s);\n" +
+ " }\n" +
+ " \n" +
+ " static void testTriangle(Shape s) {\n" +
+ " switch (s) {\n" +
+ " case Triangle t \n" +
+ " when t.calculateArea() > 100 ->\n" +
+ " System.out.println(\"...Large triangle...\");\n" +
+ " default ->\n" +
+ " System.out.println(\"...A shape, possibly a small triangle...\");\n" +
+ " }\n" +
+ " }\n" +
+ "}";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ MethodDeclaration[] methods = type.getMethods();
+ MethodDeclaration testTriangleMethod = null;
+ for (MethodDeclaration method : methods) {
+ SimpleName sName= method.getName();
+ if ("testTriangle".equals(sName.getIdentifier())) {
+ testTriangleMethod = method;
+ }
+ }
+ assertNotNull("expected Method not found", testTriangleMethod);
+ List<ASTNode> statements = testTriangleMethod.getBody().statements();
+ ASTNode stmt = statements.get(0);
+ assertEquals("Not a Switch Statament", ASTNode.SWITCH_STATEMENT, stmt.getNodeType());
+ SwitchStatement swStmt = (SwitchStatement) stmt;
+ statements = swStmt.statements();
+ ASTNode cCase = statements.get(0);
+ assertEquals("Not a Switch Case", ASTNode.SWITCH_CASE, cCase.getNodeType());
+ SwitchCase swCase = (SwitchCase) cCase;
+ List<ASTNode> expressions = swCase.expressions();
+ ASTNode exp = expressions.get(0);
+ assertEquals("Not a Guarded Pattern", ASTNode.GUARDED_PATTERN, exp.getNodeType());
+ GuardedPattern gPattern = (GuardedPattern) exp;
+ int restrictedWhenStartPos = gPattern.getRestrictedIdentifierStartPosition();
+ assertEquals("Not correct restricted start position", 451, restrictedWhenStartPos);
+ }
+
+
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_PreviewTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_PreviewTest.java
index 1422acadd..5aff9a328 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_PreviewTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_PreviewTest.java
@@ -46,10 +46,10 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
super.setUpSuite();
this.ast = AST.newAST(getASTLatest(), false);
this.currentProject = getJavaProject("Converter_17");
- if (this.ast.apiLevel() == AST.JLS18) {
- this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_18);
- this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_18);
- this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_18);
+ if (this.ast.apiLevel() == AST.JLS19) {
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_19);
this.currentProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
this.currentProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
@@ -76,12 +76,12 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
}
private void printJREError() {
- System.err.println("Test "+getName()+" requires a JRE 18");
+ System.err.println("Test "+getName()+" requires a JRE 19");
}
@SuppressWarnings("rawtypes")
public void testTypePattern() throws CoreException {
- if (!isJRE18) {
+ if (!isJRE19) {
printJREError();
return;
}
@@ -127,9 +127,10 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
}
+ // This was valid for Java 18 but not in Java 19
@SuppressWarnings("rawtypes")
- public void testGuardedPattern() throws CoreException {
- if (!isJRE18) {
+ public void _testGuardedPattern() throws CoreException {
+ if (!isJRE19) {
printJREError();
return;
}
@@ -185,7 +186,7 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
@SuppressWarnings("rawtypes")
public void testParenthesizedExpressionPattern() throws CoreException {
- if (!isJRE18) {
+ if (!isJRE19) {
printJREError();
return;
}
@@ -226,7 +227,7 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
@SuppressWarnings("rawtypes")
public void testNullPattern() throws CoreException {
- if (!isJRE18) {
+ if (!isJRE19) {
printJREError();
return;
}
@@ -259,7 +260,7 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
@SuppressWarnings("rawtypes")
public void testCaseDefaultExpressionPattern() throws CoreException {
- if (!isJRE18) {
+ if (!isJRE19) {
printJREError();
return;
}
@@ -291,7 +292,7 @@ public class ASTConverter_PreviewTest extends ConverterTestSetup {
}
public void testBug575250() throws CoreException {
- if (!isJRE18) {
+ if (!isJRE19) {
System.err.println("Test "+getName()+" requires a JRE 18");
return;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_RecordPattern_Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_RecordPattern_Test.java
new file mode 100644
index 000000000..c863ab22d
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter_RecordPattern_Test.java
@@ -0,0 +1,593 @@
+/*******************************************************************************
+ * Copyright (c) 2020, 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.dom;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AbstractTypeDeclaration;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.GuardedPattern;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.ParenthesizedExpression;
+import org.eclipse.jdt.core.dom.Pattern;
+import org.eclipse.jdt.core.dom.PatternInstanceofExpression;
+import org.eclipse.jdt.core.dom.RecordPattern;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.SwitchCase;
+import org.eclipse.jdt.core.dom.SwitchExpression;
+import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.dom.Type;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypePattern;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+
+import junit.framework.Test;
+
+public class ASTConverter_RecordPattern_Test extends ConverterTestSetup {
+
+ ICompilationUnit workingCopy;
+
+ public void setUpSuite() throws Exception {
+ super.setUpSuite();
+ this.ast = AST.newAST(getASTLatest(), false);
+ this.currentProject = getJavaProject("Converter_19");
+ if (this.ast.apiLevel() == AST.JLS19) {
+ this.currentProject.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_19);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ this.currentProject.setOption(JavaCore.COMPILER_PB_REPORT_PREVIEW_FEATURES, JavaCore.IGNORE);
+
+ }
+ }
+
+ public ASTConverter_RecordPattern_Test(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ return buildModelTestSuite(ASTConverter_RecordPattern_Test.class);
+ }
+
+ static int getASTLatest() {
+ return AST.getJLSLatest();
+ }
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ if (this.workingCopy != null) {
+ this.workingCopy.discardWorkingCopy();
+ this.workingCopy = null;
+ }
+ }
+
+ private void printJREError() {
+ System.err.println("Test "+getName()+" requires a JRE 19");
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testTypePattern() throws CoreException {
+ if (!isJRE19) {
+ printJREError();
+ return;
+ }
+ String contents = "public class X {\n" +
+ "void foo(Object o) {\n" +
+ " switch (o) {\n" +
+ " case Integer i -> System.out.println(i.toString());\n" +
+ " case String s -> System.out.println(s);\n" +
+ " default -> System.out.println(o.toString());\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.SWITCH_STATEMENT);
+ List statements = ((SwitchStatement)node).statements();
+ assertEquals("incorrect no of statements", 6, statements.size());
+ SwitchCase caseInteger = (SwitchCase) statements.get(0);
+ Expression typePattern = (Expression)caseInteger.expressions().get(0);
+ assertEquals("Type Pattern", typePattern.getNodeType(), ASTNode.TYPE_PATTERN);
+ SingleVariableDeclaration patternVariable = ((TypePattern)typePattern).getPatternVariable();
+ assertEquals("Type Pattern Integer", "Integer", patternVariable.getType().toString());
+ SingleVariableDeclaration patternVariable2 = ((TypePattern)typePattern).patternVariables().get(0);
+ assertEquals(patternVariable, patternVariable2);
+
+ SwitchCase caseString = (SwitchCase) statements.get(2);
+ typePattern = (Expression)caseString.expressions().get(0);
+ assertEquals("Type Pattern", typePattern.getNodeType(), ASTNode.TYPE_PATTERN);
+ patternVariable = ((TypePattern)typePattern).getPatternVariable();
+ assertEquals("Type Pattern Integer", "String", patternVariable.getType().toString());
+ patternVariable2 = ((TypePattern)typePattern).patternVariables().get(0);
+ assertEquals(patternVariable, patternVariable2);
+
+ SwitchCase caseDefault = (SwitchCase) statements.get(4);
+ assertTrue("Default case", caseDefault.isDefault());
+
+ }
+
+ // This was valid for Java 18 but not in Java 19
+ @SuppressWarnings("rawtypes")
+ public void _testGuardedPattern() throws CoreException {
+ if (!isJRE19) {
+ printJREError();
+ return;
+ }
+ String contents = "public class X {\n" +
+ "void foo(Object o) {\n" +
+ " switch (o) {\n" +
+ " case Integer i && (i.intValue() > 10) -> System.out.println(\"Greater than 10 \");\n" +
+ " case String s && s.equals(\"ff\") -> System.out.println(s);\n" +
+ " default -> System.out.println(o.toString());\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.SWITCH_STATEMENT);
+ List statements = ((SwitchStatement)node).statements();
+ assertEquals("incorrect no of statements", 6, statements.size());
+ SwitchCase caseInteger = (SwitchCase) statements.get(0);
+ Expression guardedPattern = (Expression)caseInteger.expressions().get(0);
+ assertEquals("Guarded Pattern", guardedPattern.getNodeType(), ASTNode.GUARDED_PATTERN);
+ Pattern pattern = ((GuardedPattern)guardedPattern).getPattern();
+ SingleVariableDeclaration patternVariable = ((TypePattern)pattern).getPatternVariable();
+ assertEquals("Type Pattern Integer", "Integer", patternVariable.getType().toString());
+ SingleVariableDeclaration patternVariable2 = ((TypePattern)pattern).patternVariables().get(0);
+ assertEquals(patternVariable, patternVariable2);
+ Expression expression = ((GuardedPattern)guardedPattern).getExpression();
+ Expression expression2 = ((ParenthesizedExpression)expression).getExpression();
+ assertEquals("Infix expression", "i.intValue() > 10", expression2.toString());
+
+
+ SwitchCase caseString = (SwitchCase) statements.get(2);
+ guardedPattern = (Expression)caseString.expressions().get(0);
+ assertEquals("Guarded Pattern", guardedPattern.getNodeType(), ASTNode.GUARDED_PATTERN);
+ pattern = ((GuardedPattern)guardedPattern).getPattern();
+ patternVariable = ((TypePattern)pattern).getPatternVariable();
+ assertEquals("Type Pattern String", "String", patternVariable.getType().toString());
+ patternVariable2 = ((TypePattern)pattern).patternVariables().get(0);
+ assertEquals(patternVariable, patternVariable2);
+ expression = ((GuardedPattern)guardedPattern).getExpression();
+ assertEquals("Infix expression", "s.equals(\"ff\")",expression.toString());
+
+ SwitchCase caseDefault = (SwitchCase) statements.get(4);
+ assertTrue("Default case", caseDefault.isDefault());
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testParenthesizedExpressionPattern() throws CoreException {
+ if (!isJRE19) {
+ printJREError();
+ return;
+ }
+ String contents = "public class X {\n" +
+ "void foo(Object o) {\n" +
+ " switch (o) {\n" +
+ " case (Integer i) : System.out.println(i.toString());\n" +
+ " default : System.out.println(o.toString());\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.SWITCH_STATEMENT);
+ List statements = ((SwitchStatement)node).statements();
+ assertEquals("incorrect no of statements", 4, statements.size());
+ SwitchCase caseInteger = (SwitchCase) statements.get(0);
+ Expression parenthesizedExpression = (Expression)caseInteger.expressions().get(0);
+ assertEquals("Parenthesized Expression", parenthesizedExpression.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
+ Expression targetPattern = ((ParenthesizedExpression)parenthesizedExpression).getExpression();
+ assertEquals("Type Pattern", targetPattern.getNodeType(), ASTNode.TYPE_PATTERN);
+ SingleVariableDeclaration patternVariable = ((TypePattern)targetPattern).getPatternVariable();
+ assertEquals("Type Pattern Integer", "Integer", patternVariable.getType().toString());
+ SingleVariableDeclaration patternVariable2 = ((TypePattern)targetPattern).patternVariables().get(0);
+ assertEquals(patternVariable, patternVariable2);
+
+ SwitchCase caseDefault = (SwitchCase) statements.get(2);
+ assertTrue("Default case", caseDefault.isDefault());
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testNullPattern() throws CoreException {
+ if (!isJRE19) {
+ printJREError();
+ return;
+ }
+ String contents = "public class X {\n" +
+ "void foo(Object o) {\n" +
+ " switch (o) {\n" +
+ " case Integer i : System.out.println(i.toString());\n" +
+ " break;\n" +
+ " case null : System.out.println(\"null\");\n" +
+ " default : System.out.println(o.toString());\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.SWITCH_STATEMENT);
+ List statements = ((SwitchStatement)node).statements();
+ assertEquals("incorrect no of statements", 7, statements.size());
+ SwitchCase caseInteger = (SwitchCase) statements.get(3);
+ Expression nullExpression = (Expression)caseInteger.expressions().get(0);
+ assertEquals("Null Expression", nullExpression.getNodeType(), ASTNode.NULL_LITERAL);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testCaseDefaultExpressionPattern() throws CoreException {
+ if (!isJRE19) {
+ printJREError();
+ return;
+ }
+ String contents = "public class X {\n" +
+ "void foo(Object o) {\n" +
+ " switch (o) {\n" +
+ " case Integer i : System.out.println(i.toString());\n" +
+ " case default : System.out.println(o.toString());\n" +
+ " }\n" +
+ "}\n" +
+ "\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = getASTNode(compilationUnit, 0, 0, 0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.SWITCH_STATEMENT);
+ List statements = ((SwitchStatement)node).statements();
+ assertEquals("incorrect no of statements", 4, statements.size());
+ SwitchCase caseDefault = (SwitchCase) statements.get(2);
+ Expression caseDefaultExpression = (Expression) caseDefault.expressions().get(0);
+ assertEquals("Case Default Expression",caseDefaultExpression.getNodeType() , ASTNode.CASE_DEFAULT_EXPRESSION);
+
+
+ }
+
+ public void testBug575250() throws CoreException {
+ if (!isJRE19) {
+ System.err.println("Test "+getName()+" requires a JRE 18");
+ return;
+ }
+ String contents = "public class X {\n" +
+ " static void foo(Object o) {\n" +
+ " switch (o) {\n" +
+ " case (Integer i_1): System.out.println(\"Integer\");\n" +
+ " default: System.out.println(\"Object\");" +
+ " }\n" +
+ " }\n" +
+ "}\n";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ List<AbstractTypeDeclaration> types = compilationUnit.types();
+ assertEquals("incorrect types", types.size(), 1);
+ AbstractTypeDeclaration type = types.get(0);
+ assertTrue("should be a type", type instanceof TypeDeclaration);
+ TypeDeclaration typeDecl = (TypeDeclaration)type;
+ final List<TypePattern> result = new ArrayList<>();
+ typeDecl.accept(new ASTVisitor() {
+ public boolean visit(TypePattern n) {
+ result.add(n);
+ return true;
+ }
+ });
+ assertEquals("incorrect no of patterns", 1, result.size());
+ TypePattern typePattern = result.get(0);
+ assertNotNull("pattern is null", typePattern);
+ int start = contents.indexOf("Integer");
+ int length = "Integer i_1".length();
+ assertEquals("wrong source range", typePattern.getStartPosition(), start);
+ assertEquals("wrong source range", typePattern.getLength(), length);
+
+ SingleVariableDeclaration patternVariable = typePattern.getPatternVariable();
+ assertEquals("wrong source range", patternVariable.getStartPosition(), start);
+ assertEquals("wrong source range", patternVariable.getLength(), length);
+
+ Type type2 = patternVariable.getType();
+ assertEquals("wrong source range", type2.getStartPosition(), start);
+ assertEquals("wrong source range", type2.getLength(), "Integer".length());
+
+ SimpleName name = patternVariable.getName();
+ start = contents.indexOf("i_1");
+ assertEquals("wrong source range", name.getStartPosition(), start);
+ assertEquals("wrong source range", name.getLength(), "i_1".length());
+ }
+
+ public void testRecordPattern001() throws CoreException {
+ if (!isJRE19) {
+ printJREError();
+ return;
+ }
+ String contents = "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \");\n"
+ + " System.out.println(r1.toString());\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ MethodDeclaration[] methods = type.getMethods();
+ assertEquals("Method list empty", 2, methods.length);
+ MethodDeclaration printMethod = methods[0];
+ assertEquals("Method name is not print", "print", printMethod.getName().toString());
+ List<ASTNode> statements = printMethod.getBody().statements();
+ IfStatement ifStatement = (IfStatement)statements.get(0);
+ assertEquals("Not a PatternInstanceOf Expression", true, ifStatement.getExpression() instanceof PatternInstanceofExpression);
+ PatternInstanceofExpression patternExpression = (PatternInstanceofExpression)ifStatement.getExpression();
+ assertEquals("Name of right Operand is not r1", "r1", patternExpression.getRightOperand().getName().toString());
+
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testRecordPattern002() throws CoreException {
+ if (!isJRE19) {
+ System.err.println("Test "+getName()+" requires a JRE 19");
+ return;
+ }
+ String contents = "public class X {\n"
+ + " public static void print(Record r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Record(int x) r1 -> x ;\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \");\n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Record(3));\n"
+ + " }\n"
+ + "}\n"
+ + "record Record(int x) {}";
+
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ MethodDeclaration[] methods = type.getMethods();
+ assertEquals("Method list empty", 2, methods.length);
+ MethodDeclaration printMethod = methods[0];
+ assertEquals("Method name is not print", "print", printMethod.getName().toString());
+ List<ASTNode> statements = printMethod.getBody().statements();
+ VariableDeclarationStatement switchCasestatement = (VariableDeclarationStatement)statements.get(0);
+ List fragments = switchCasestatement.fragments();
+ assertEquals("Incorrect no of fragments", 1, fragments.size());
+ node = (ASTNode) fragments.get(0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
+ Expression initializer = fragment.getInitializer();
+ assertEquals("incorrect type", ASTNode.SWITCH_EXPRESSION, initializer.getNodeType());
+ List switchStatements = ((SwitchExpression) initializer).statements();
+
+ SwitchCase caseStmt = (SwitchCase) switchStatements.get(0);
+ assertEquals("incorrect type", ASTNode.RECORD_PATTERN, ((Expression)caseStmt.expressions().get(0)).getNodeType());
+ RecordPattern recordPattern = (RecordPattern)caseStmt.expressions().get(0);
+ assertEquals("StartPosition of Record Pattern is not 94",94 , recordPattern.getStartPosition());
+ assertEquals("Length of Record Pattern is not 16",16 , recordPattern.getLength());
+ assertEquals("Type of RecordPattern variable is not Record","Record" , recordPattern.getPatternType().toString());
+ assertEquals("StartPosition of Type variable is not 94",94 , recordPattern.getPatternType().getStartPosition());
+ assertEquals("Length of Record Pattern is not 6",6 , recordPattern.getPatternType().getLength());
+ assertEquals("Name of RecordPattern variableis not r1","r1" , recordPattern.getPatternName().toString());
+ assertEquals("StartPosition of Record Pattern is not 108",108 , recordPattern.getPatternName().getStartPosition());
+ assertEquals("Length of Record Pattern is not 2",2 , recordPattern.getPatternName().getLength());
+ assertEquals("Type of Nested pattern in RecordPattern is not TypePattern",ASTNode.TYPE_PATTERN , recordPattern.patterns().get(0).getNodeType());
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testRecordPattern003() throws CoreException {
+ if (!isJRE19) {
+ System.err.println("Test "+getName()+" requires a JRE 19");
+ return;
+ }
+ String contents = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ MethodDeclaration[] methods = type.getMethods();
+ assertEquals("Method list empty", 2, methods.length);
+ MethodDeclaration printMethod = methods[0];
+ assertEquals("Method name is not printLowerRight", "printLowerRight", printMethod.getName().toString());
+ List<ASTNode> statements = printMethod.getBody().statements();
+ VariableDeclarationStatement switchCasestatement = (VariableDeclarationStatement)statements.get(0);
+ List fragments = switchCasestatement.fragments();
+ assertEquals("Incorrect no of fragments", 1, fragments.size());
+ node = (ASTNode) fragments.get(0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
+ Expression initializer = fragment.getInitializer();
+ assertEquals("incorrect type", ASTNode.SWITCH_EXPRESSION, initializer.getNodeType());
+ List switchStatements = ((SwitchExpression) initializer).statements();
+
+ SwitchCase caseStmt = (SwitchCase) switchStatements.get(0);
+ assertEquals("incorrect type", ASTNode.RECORD_PATTERN, ((Expression)caseStmt.expressions().get(0)).getNodeType());
+ RecordPattern recordPattern = (RecordPattern)caseStmt.expressions().get(0);
+ assertEquals("Type of RecordPattern variable is not Rectangle","Rectangle" , recordPattern.getPatternType().toString());
+ assertEquals("Name of RecordPattern variable is not r1","r1" , recordPattern.getPatternName().toString());
+ assertEquals("There should be 2 nested Patterns in Rectangle", 2 , recordPattern.patterns().size());
+ assertEquals("Type of Nested pattern in Rectangle is not RecordPattern",ASTNode.RECORD_PATTERN , recordPattern.patterns().get(0).getNodeType());
+ assertEquals("Type of Nested pattern in Rectangle is not TypePattern",ASTNode.TYPE_PATTERN , recordPattern.patterns().get(1).getNodeType());
+ RecordPattern recordPattern1 = (RecordPattern)recordPattern.patterns().get(0);
+ assertEquals("Type of RecordPattern variable is not ColoredPoint","ColoredPoint" , recordPattern1.getPatternType().toString());
+ assertEquals("Name of RecordPattern variable is not null", null , recordPattern1.getPatternName());
+ assertEquals("There should be 2 nested Patterns in ColoredPoint", 2 , recordPattern1.patterns().size());
+ assertEquals("Type of Nested pattern in ColoredPoint is not RecordPattern",ASTNode.RECORD_PATTERN , recordPattern1.patterns().get(0).getNodeType());
+ assertEquals("Type of Nested pattern in ColoredPoint is not TypePattern",ASTNode.TYPE_PATTERN , recordPattern1.patterns().get(1).getNodeType());
+ RecordPattern recordPattern2 = (RecordPattern)recordPattern1.patterns().get(0);
+ assertEquals("Type of RecordPattern variable is not Point","Point" , recordPattern2.getPatternType().toString());
+ assertEquals("Name of RecordPattern variable is not null", null , recordPattern2.getPatternName());
+ assertEquals("There should be 2 nested Patterns in Point", 2 , recordPattern2.patterns().size());
+ assertEquals("Type of Nested pattern in Point is not TypePattern",ASTNode.TYPE_PATTERN , recordPattern2.patterns().get(0).getNodeType());
+ assertEquals("Type of Nested pattern in Point is not TypePattern",ASTNode.TYPE_PATTERN , recordPattern2.patterns().get(1).getNodeType());
+
+ }
+
+ @SuppressWarnings("rawtypes")
+ public void testRecordPattern004() throws CoreException {
+ if (!isJRE19) {
+ System.err.println("Test "+getName()+" requires a JRE 19");
+ return;
+ }
+ String contents = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x > 0 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+
+ this.workingCopy = getWorkingCopy("/Converter_19/src/X.java", true/*resolve*/);
+ ASTNode node = buildAST(
+ contents,
+ this.workingCopy);
+ assertEquals("Not a compilation unit", ASTNode.COMPILATION_UNIT, node.getNodeType());
+ CompilationUnit compilationUnit = (CompilationUnit) node;
+ assertProblemsSize(compilationUnit, 0);
+ node = ((AbstractTypeDeclaration)compilationUnit.types().get(0));
+ assertEquals("Not a Type Declaration", ASTNode.TYPE_DECLARATION, node.getNodeType());
+ TypeDeclaration type = (TypeDeclaration)node;
+ MethodDeclaration[] methods = type.getMethods();
+ assertEquals("Method list empty", 2, methods.length);
+ MethodDeclaration printMethod = methods[0];
+ assertEquals("Method name is not printLowerRight", "printLowerRight", printMethod.getName().toString());
+ List<ASTNode> statements = printMethod.getBody().statements();
+ VariableDeclarationStatement switchCasestatement = (VariableDeclarationStatement)statements.get(0);
+ List fragments = switchCasestatement.fragments();
+ assertEquals("Incorrect no of fragments", 1, fragments.size());
+ node = (ASTNode) fragments.get(0);
+ assertEquals("Switch statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_FRAGMENT);
+ VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
+ Expression initializer = fragment.getInitializer();
+ assertEquals("incorrect type", ASTNode.SWITCH_EXPRESSION, initializer.getNodeType());
+ List switchStatements = ((SwitchExpression) initializer).statements();
+
+ SwitchCase caseStmt = (SwitchCase) switchStatements.get(0);
+ assertEquals("incorrect type", ASTNode.GUARDED_PATTERN, ((Expression)caseStmt.expressions().get(0)).getNodeType());
+ GuardedPattern guardedPattern = (GuardedPattern)caseStmt.expressions().get(0);
+ assertEquals("There should be 1 Record Pattern", ASTNode.RECORD_PATTERN , guardedPattern.getPattern().getNodeType());
+
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
index 118decacf..ef0b4b030 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
@@ -7,7 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
* Contributors:
* IBM Corporation - initial API and implementation
* Technical University Berlin - adapted for Object Teams
@@ -447,9 +446,9 @@ public class ASTStructuralPropertyTest extends org.eclipse.jdt.core.tests.junit.
}
// {ObjectTeams: adapted for OT specific ASTNodes
/* orig:
- assertEquals("Wrong last known type", 112, hi); // last known one
+ assertEquals("Wrong last known type", 113, hi); // last known one
:giro */
- assertEquals("Wrong last known type", 128, hi); // last known one
+ assertEquals("Wrong last known type", 129, hi); // last known one
// jwl}
assertEquals("Wrong number of distinct types", hi, classes.size()); // all classes are distinct
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
index 20e7ec047..393646fa2 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
@@ -1334,6 +1334,7 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
case JavaCore.VERSION_16: return AST.JLS16;
case JavaCore.VERSION_17: return AST.JLS17;
case JavaCore.VERSION_18: return AST.JLS18;
+ case JavaCore.VERSION_19: return AST.JLS19;
default: return AST.JLS2;
}
}
@@ -9511,6 +9512,7 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
ASTNode.TAG_PROPERTY,
ASTNode.JAVADOC_REGION,
ASTNode.JAVADOC_TEXT_ELEMENT,
+ ASTNode.RECORD_PATTERN,
//{ObjectTeams:
ASTNode.METHOD_SPEC,
ASTNode.CALLIN_MAPPING_DECLARATION,
@@ -9580,7 +9582,7 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
@SuppressWarnings("deprecation")
public void testASTLevels() throws Exception {
- int[] apilLevels = {AST.JLS2, AST.JLS3, AST.JLS4, AST.JLS8, AST.JLS9, AST.JLS10, AST.JLS11, AST.JLS12, AST.JLS13, AST.JLS14, AST.JLS15, AST.JLS16, AST.JLS17,AST.JLS18};
+ int[] apilLevels = {AST.JLS2, AST.JLS3, AST.JLS4, AST.JLS8, AST.JLS9, AST.JLS10, AST.JLS11, AST.JLS12, AST.JLS13, AST.JLS14, AST.JLS15, AST.JLS16, AST.JLS17,AST.JLS18, AST.JLS19};
for (int level : apilLevels) {
try {
DOMASTUtil.checkASTLevel(level);
@@ -9588,8 +9590,6 @@ public class ASTTest extends org.eclipse.jdt.core.tests.junit.extension.TestCase
throw new AssertionFailedError("missing support for AST level: " + level);
}
}
-
-
}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
index b8e4457f5..a03fadf06 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/AbstractASTTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2020 IBM Corporation and others.
+ * Copyright (c) 2004, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -494,7 +494,9 @@ public class AbstractASTTests extends ModifyingResourceTests implements DefaultM
String option = cu.getJavaProject().getOption(JavaCore.COMPILER_COMPLIANCE, true);
long jdkLevel = CompilerOptions.versionToJdkLevel(option);
int JLSLevel = AST_INTERNAL_JLS3;
- if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_18)) {
+ if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_19)) {
+ JLSLevel = AST_INTERNAL_JLS19;
+ } else if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_18)) {
JLSLevel = AST_INTERNAL_JLS18;
} else if (jdkLevel >= ClassFileConstants.getComplianceLevelForJavaVersion(ClassFileConstants.MAJOR_VERSION_17)) {
JLSLevel = AST_INTERNAL_JLS17;
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
index 4ed4cd3c9..aeb7407b8 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ConverterTestSetup.java
@@ -7,6 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
+ *
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.core.tests.dom;
@@ -110,6 +111,7 @@ public abstract class ConverterTestSetup extends AbstractASTTests {
this.deleteProject("Converter_15_1"); //$NON-NLS-1$
this.deleteProject("Converter_16"); //$NON-NLS-1$
this.deleteProject("Converter_17"); //$NON-NLS-1$
+ this.deleteProject("Converter_19"); //$NON-NLS-1$
PROJECT_SETUP = false;
} else {
TEST_SUITES.remove(getClass());
@@ -128,6 +130,7 @@ public abstract class ConverterTestSetup extends AbstractASTTests {
this.deleteProject("Converter_15_1"); //$NON-NLS-1$
this.deleteProject("Converter_16"); //$NON-NLS-1$
this.deleteProject("Converter_17"); //$NON-NLS-1$
+ this.deleteProject("Converter_19"); //$NON-NLS-1$
PROJECT_SETUP = false;
}
}
@@ -222,6 +225,14 @@ public abstract class ConverterTestSetup extends AbstractASTTests {
new IPath[] {getConverterJCLPath("17"), getConverterJCLSourcePath("17"), getConverterJCLRootSourcePath()},
null);
}
+ } else if ("19".equals(compliance)) {
+ if (JavaCore.getClasspathVariable("CONVERTER_JCL_19_LIB") == null) {
+ setupExternalJCL("converterJclMin19");
+ JavaCore.setClasspathVariables(
+ new String[] {"CONVERTER_JCL_19_LIB", "CONVERTER_JCL_19_SRC", "CONVERTER_JCL_19_SRCROOT"},
+ new IPath[] {getConverterJCLPath("19"), getConverterJCLSourcePath("19"), getConverterJCLRootSourcePath()},
+ null);
+ }
} else if (JavaCore.getClasspathVariable("CONVERTER_JCL_LIB") == null) {
setupExternalJCL("converterJclMin");
JavaCore.setClasspathVariables(
@@ -253,6 +264,7 @@ public abstract class ConverterTestSetup extends AbstractASTTests {
setUpJavaProject("Converter_15_1", "15"); //$NON-NLS-1$ //$NON-NLS-2$
setUpJavaProject("Converter_16", "16"); //$NON-NLS-1$ //$NON-NLS-2$
setUpJavaProject("Converter_17", "17"); //$NON-NLS-1$ //$NON-NLS-2$
+ setUpJavaProject("Converter_19", "19"); //$NON-NLS-1$ //$NON-NLS-2$
waitUntilIndexesReady(); // needed to find secondary types
PROJECT_SETUP = true;
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
index 918141d08..f3ec82fe5 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/RunConverterTests.java
@@ -57,7 +57,10 @@ public static Class[] getAllTestClasses() {
ASTConverter14Test.class,
ASTConverter_15Test.class,
ASTConverter_16Test.class,
+ ASTConverter_17Test.class,
+ ASTConverter_GuardedPattern_Test.class,
ASTConverter_PreviewTest.class,
+ ASTConverter_RecordPattern_Test.class,
};
}
public static Test suite() {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
index 6d9c98100..56fb38b65 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterBugsTests.java
@@ -29,6 +29,7 @@ import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;
import org.eclipse.jdt.core.formatter.IndentManipulation;
+import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatter;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions;
import org.eclipse.jdt.internal.formatter.DefaultCodeFormatterOptions.Alignment;
@@ -13305,4 +13306,36 @@ public void testBug576954() {
" }\n" +
"}");
}
+/**
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/443
+ */
+public void testIssue443a() {
+ setComplianceLevel(CompilerOptions.VERSION_17);
+ this.formatterPrefs.insert_space_after_closing_angle_bracket_in_type_parameters = true;
+ formatSource(
+ "record MyRecord<A>() {\n" +
+ "}");
+}
+public void testIssue443b() {
+ setComplianceLevel(CompilerOptions.VERSION_17);
+ this.formatterPrefs.insert_space_after_closing_angle_bracket_in_type_parameters = false;
+ formatSource(
+ "class MyClass<A> extends AnotherClass {\n" +
+ "}\n" +
+ "\n" +
+ "sealed interface Expr<A> permits MathExpr {\n" +
+ "}");
+}
+/**
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/369
+ */
+public void testIssue369() {
+ setComplianceLevel(CompilerOptions.VERSION_17);
+ this.formatterPrefs.insert_space_after_opening_paren_in_record_declaration = true;
+ this.formatterPrefs.insert_space_before_closing_paren_in_record_declaration = true;
+ formatSource(
+ "@JsonPropertyOrder({ \"position\", \"value\" })\n" +
+ "public record ValueWithPosition( String position, String value ) {\n" +
+ "}");
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
index f805d3c8c..93ddb1a77 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter/FormatterRegressionTests.java
@@ -15948,7 +15948,8 @@ public void testBug567016() {
* https://bugs.eclipse.org/573949 - [17][switch pattern][formatter] JEP 406 changes
*/
public void testBug573949() {
- setComplianceLevel(CompilerOptions.VERSION_18);
+ setComplianceLevel(CompilerOptions.VERSION_19);
+ this.formatterOptions.put(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
String source =
"public class X {\n" +
" private static void foo(Object o) {\n" +
@@ -15960,7 +15961,7 @@ public void testBug573949() {
"\n" +
"static void testTriangle(Shape s) {\n" +
" switch (s) {\n" +
- " case Triangle t&&(t.calculateArea() > 100) ->\n" +
+ " case Triangle t when t.calculateArea() > 100 ->\n" +
" System.out.println(\"Large triangle\");\n" +
" default ->\n" +
" System.out.println(\"A shape, possibly a small triangle\");\n" +
@@ -15980,7 +15981,7 @@ public void testBug573949() {
"\n" +
" static void testTriangle(Shape s) {\n" +
" switch (s) {\n" +
- " case Triangle t && (t.calculateArea() > 100) -> System.out.println(\"Large triangle\");\n" +
+ " case Triangle t when t.calculateArea() > 100 -> System.out.println(\"Large triangle\");\n" +
" default -> System.out.println(\"A shape, possibly a small triangle\");\n" +
" }\n" +
" }\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
index 20425018c..c7fbaf97b 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
@@ -166,6 +166,7 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
protected static boolean isJRE16 = false;
protected static boolean isJRE17 = false;
protected static boolean isJRE18 = false;
+ protected static boolean isJRE19 = false;
static {
String javaVersion = System.getProperty("java.version");
String vmName = System.getProperty("java.vm.name");
@@ -178,6 +179,9 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
}
}
long jdkLevel = CompilerOptions.versionToJdkLevel(javaVersion.length() > 3 ? javaVersion.substring(0, 3) : javaVersion);
+ if (jdkLevel >= ClassFileConstants.JDK19) {
+ isJRE19 = true;
+ }
if (jdkLevel >= ClassFileConstants.JDK18) {
isJRE18 = true;
}
@@ -270,9 +274,14 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
protected static final int AST_INTERNAL_JLS17 = AST.JLS17;
/**
* Internal synonym for constant AST.JSL18
+ * @deprecated
*/
protected static final int AST_INTERNAL_JLS18 = AST.JLS18;
/**
+ * Internal synonym for constant AST.JSL19
+ */
+ protected static final int AST_INTERNAL_JLS19 = AST.JLS19;
+ /**
* Internal synonym for the latest AST level.
*
*/
@@ -3460,7 +3469,11 @@ public abstract class AbstractJavaModelTests extends SuiteOfTestCases {
newJclSrcString = "JCL18_SRC"; // Use the same source
}
} else {
- if (compliance.equals("17")) {
+ if (compliance.equals("19")) {
+ // Reuse the same 14 stuff as of now. No real need for a new one
+ newJclLibString = "JCL_19_LIB";
+ newJclSrcString = "JCL_19_SRC";
+ } else if (compliance.equals("17")) {
// Reuse the same 14 stuff as of now. No real need for a new one
newJclLibString = "JCL_17_LIB";
newJclSrcString = "JCL_17_SRC";
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
index 378707522..19cdf70ea 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java
@@ -25,6 +25,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URI;
import java.nio.file.InvalidPathException;
+import java.util.Arrays;
import java.util.Hashtable;
import java.util.Map;
@@ -7478,4 +7479,61 @@ public void testBug539998() throws CoreException {
this.deleteProjects(new String[] { "P1", "P2" });
}
}
+
+public void testBug576735a() throws Exception {
+ IJavaProject project = this.createJavaProject("P1", new String[] {"src"}, new String[] { "JCL18_LIB"}, "bin", "1.8" );
+ try {
+ String projectLocation = project.getProject().getLocation().toOSString();
+
+ // create a jar that will be missing from P1's dependencies:
+ Util.createJar(
+ new String[] {
+ "lib576735a1/Missing.java",
+ "package libMissing;\n" +
+ "public class Missing {\n" +
+ "}\n"
+ },
+ getDefaultJavaCoreOptions(),
+ projectLocation + File.separator + "libMissing.jar");
+
+ // create another jar depending on libMissing.jar:
+ String[] classpath = getJCL15PlusLibraryIfNeeded("1.8");
+ classpath = Arrays.copyOf(classpath, classpath.length+1);
+ classpath[classpath.length-1] = projectLocation + File.separator + "libMissing.jar";
+ Util.createJar(
+ new String[] {
+ "lib576735a/Lib.java",
+ "package lib576735a;\n" +
+ "public class Lib {\n" +
+ " void m(libMissing.Missing arg) {}\n" +
+ "}\n"
+ },
+ new String[0],
+ getDefaultJavaCoreOptions(),
+ classpath,
+ projectLocation + File.separator + "lib576735a.jar");
+ project.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
+ addLibraryEntry(project, "/P1/lib576735a.jar", false);
+
+ createFile(
+ "/P1/src/X.java",
+ "/* header comment */\n" + // #1 (locationless): The type libMissing.Missing cannot be resolved. It is indirectly referenced from required type lib576735a.Lib
+ "import libMissing.Missing;\n" + // #2: The import libMissing.Missing cannot be resolved
+ "public class X extends lib576735a.Lib {\n" +
+ " Missing f;\n" + // #4: Missing cannot be resolved to a type
+ "}\n"
+ );
+
+ project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+ IMarker[] markers = project.getProject().findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE);
+ sortMarkers(markers);
+ assertMarkers("Unexpected markers",
+ "The project was not built since its build path is incomplete. Cannot find the class file for libMissing.Missing. Fix the build path then try building this project\n" +
+ "The type libMissing.Missing cannot be resolved. It is indirectly referenced from required type lib576735a.Lib",
+ markers);
+ } finally {
+ if ( project != null && project.exists())
+ this.deleteProject("P1");
+ }
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests19.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests19.java
new file mode 100644
index 000000000..828c2b7a9
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests19.java
@@ -0,0 +1,465 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.model;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+import junit.framework.Test;
+
+public class CompletionTests19 extends AbstractJavaModelCompletionTests {
+
+
+ static {
+ // TESTS_NAMES = new String[]{"test034"};
+ }
+
+ public CompletionTests19(String name) {
+ super(name);
+ }
+
+ public void setUpSuite() throws Exception {
+ if (COMPLETION_PROJECT == null) {
+
+ COMPLETION_PROJECT = setUpJavaProject("Completion", "19");
+ } else {
+ setUpProjectCompliance(COMPLETION_PROJECT, "19");
+ }
+ super.setUpSuite();
+ COMPLETION_PROJECT.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ }
+
+ public static Test suite() {
+ return buildModelTestSuite(CompletionTests19.class);
+ }
+ //content assist just record pattern usage
+ public void test001() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " fals \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "fals";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("false[KEYWORD]{false, null, null, false, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern switch case just after case
+ public void test002() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case /*here*/ Rectangl (ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/ Rectangl";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("Rectangle[TYPE_REF]{Rectangle, , LRectangle;, null, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern switch case - 1st level nested
+ public void test003() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(/*here*/ ColoredPoin(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/ ColoredPoin";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("ColoredPoint[TYPE_REF]{ColoredPoint, , LColoredPoint;, null, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern switch case - 2nd level nested
+ public void test004() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(/*here*/ Poin(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/ Poin";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("Point[TYPE_REF]{Point, , LPoint;, null, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern switch case - 2nd param in nested
+ public void test005() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint( Point(int x, int y), /*here*/ Colo c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/ Colo";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("Color[TYPE_REF]{Color, , LColor;, null, null, 52}\n"
+ + "ColoredPoint[TYPE_REF]{ColoredPoint, , LColoredPoint;, null, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern switch case - use the variable in case statement
+ public void test006() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint( Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " r1.toStrin ;yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "r1.toStrin";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("toString[METHOD_REF]{toString(), LRectangle;, ()Ljava.lang.String;, toString, null, 60}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern -instanceof record pattern - 2nd param in nested
+ public void test007() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " /*here*/ ColoredPoin lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/ ColoredPoin";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("ColoredPoint[TYPE_REF]{ColoredPoint, , LColoredPoint;, null, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern -instanceof record pattern - record creation
+ public void test008() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " /*here*/ ColoredPoin lr) r1)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r1);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new /*here*/ ColoredPoin(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/ ColoredPoin";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("ColoredPoint[TYPE_REF]{ColoredPoint, , LColoredPoint;, null, null, 52}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern -check for when
+ public void test009() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 whe x > 0 -> {\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 when x <= 0 -> {\n"
+ + " yield -1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(5, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "whe";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("when[KEYWORD]{when, null, null, when, null, 49}",
+ requestor.getResults());
+
+ }
+ //content assist in record pattern switch case - use the variable in case statement - CCE
+ public void test010() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " /*here*/r1. "
+ + "System.out.println(\"x= \" + x);\n"
+ + " System.out.println(\"y= \" + y);\n"
+ + " System.out.println(\"lr= \" + lr);\n"
+ + " System.out.println(\"lr.c()= \" + lr.c());\n"
+ + " System.out.println(\"lr.p()= \" + lr.p());\n"
+ + " System.out.println(\"lr.p().x()= \" + lr.p().x());\n"
+ + " System.out.println(\"lr.p().y()= \" + lr.p().y());\n"
+ + " System.out.println(\"c= \" + c);\n"
+ + " System.out.println(\"r1= \" + r1);\n"
+ + " yield x; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "/*here*/r1.";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("equals[METHOD_REF]{equals(), LRectangle;, (Ljava.lang.Object;)Z, equals, (arg0), 60}\n"
+ + "hashCode[METHOD_REF]{hashCode(), LRectangle;, ()I, hashCode, null, 60}\n"
+ + "lowerRight[FIELD_REF]{lowerRight, LRectangle;, LColoredPoint;, lowerRight, null, 60}\n"
+ + "lowerRight[METHOD_REF]{lowerRight(), LRectangle;, ()LColoredPoint;, lowerRight, null, 60}\n"
+ + "toString[METHOD_REF]{toString(), LRectangle;, ()Ljava.lang.String;, toString, null, 60}\n"
+ + "upperLeft[FIELD_REF]{upperLeft, LRectangle;, LColoredPoint;, upperLeft, null, 60}\n"
+ + "upperLeft[METHOD_REF]{upperLeft(), LRectangle;, ()LColoredPoint;, upperLeft, null, 60}",
+ requestor.getResults());
+
+ }
+ //content assist ArrayStoreException fix
+ //https://github.com/eclipse-jdt/eclipse.jdt.core/issues/345
+ public void test011() throws JavaModelException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy(
+ "/Completion/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r1 -> {\n"
+ + " fals "
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true);
+ requestor.allowAllRequiredProposals();
+ String str = this.workingCopies[0].getSource();
+ String completeBehind = "fals";
+ int cursorLocation = str.indexOf(completeBehind) + completeBehind.length();
+ this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner);
+ assertResults("false[KEYWORD]{false, null, null, false, null, 52}",
+ requestor.getResults());
+
+ }
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
index 8b4fcd83a..416c91dbc 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java
@@ -2569,7 +2569,7 @@ public void testBug360164a() throws IOException, CoreException {
assertProblems("Unexpected problems",
"----------\n" +
"1. ERROR in /P/src/X.java\n" +
- "The type java.lang.Enum cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type java.lang.Enum cannot be resolved. It is indirectly referenced from required type p360164.MyEnum\n" +
"----------\n",
problemRequestor);
} finally {
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java
index 8ebf7b29b..e6ca0a45d 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java
@@ -132,7 +132,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
@Override
public void setUpSuite() throws Exception {
super.setUpSuite();
- JAVA_PROJECT = setUpJavaProject("JavaSearchBugs", "17");
+ JAVA_PROJECT = setUpJavaProject("JavaSearchBugs", "19");
}
public void tearDownSuite() throws Exception {
@@ -389,7 +389,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"private static void foo(Object o) {\n" +
" int /*here*/local=0" +
" switch (o) {\n" +
- " case Integer i && local >9 -> System.out.println(\"Integer:\" + i +local);\n" +
+ " case Integer i when local >9 -> System.out.println(\"Integer:\" + i +local);\n" +
" case String s -> System.out.println(\"String:\" + s + local);\n" +
" default -> System.out.println(\"Object\" + o);\n" +
" }\n" +
@@ -429,7 +429,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"private static void foo(Object o) {\n" +
" switch (o) {\n" +
" case Integer i -> System.out.println(\"Integer:\" + i);\n" +
- " case String /*here*/s && s.hashCode()>0 -> System.out.println(\"String:\" );\n" +
+ " case String /*here*/s when s.hashCode()>0 -> System.out.println(\"String:\" );\n" +
" default -> System.out.println(\"Object\" + o);\n" +
" }\n" +
"}\n" +
@@ -506,7 +506,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"}\n" +
"private static void foo(S o) {\n" +
" switch (o) {\n" +
- " case A /*here*/a && a.hashCode()> 0 : System.out.println(\"A:\" + a +a); break;\n" +
+ " case A /*here*/a when a.hashCode()> 0 : System.out.println(\"A:\" + a +a); break;\n" +
" case B b : System.out.println(\"B:\" + b);\n" +
" default : System.out.println(\"Object\" + o);\n" +
" }\n" +
@@ -585,7 +585,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"}\n" +
"private static void foo(S o) {\n" +
" switch (o) {\n" +
- " case A /*here*/a && a.hashCode() : System.out.println(\"A:\" + a +a); break;\n" +
+ " case A /*here*/a when a.hashCode() : System.out.println(\"A:\" + a +a); break;\n" +
" case B b : System.out.println(\"B:\" + b);\n" +
" default : System.out.println(\"Object\" + o);\n" +
" }\n" +
@@ -625,7 +625,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"}\n" +
"private static int foo(S o) {\n" +
" switch (o) {\n" +
- " case A /*here*/a && a.hashCode()> 0 -> 1;\n" +
+ " case A /*here*/a when a.hashCode()> 0 -> 1;\n" +
" case B b ->2;\n" +
" default -> 3;\n" +
" }\n" +
@@ -700,7 +700,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"private static void foo(Object o) {\n" +
" switch (o) {\n" +
" case Integer i : System.out.println(\"Integer:\" + i);break;\n" +
- " case String /*here*/s && s.hashCode()>0 : System.out.println(\"String:\" );break;\n" +
+ " case String /*here*/s when s.hashCode()>0 : System.out.println(\"String:\" );break;\n" +
" default : System.out.println(\"Object\" + o);\n" +
" }\n" +
"}\n" +
@@ -778,7 +778,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"}\n" +
"private static void foo(S o) {\n" +
" switch (o) {\n" +
- " case A /*here*/a && a.toString().length()>2 -> System.out.println(\"A:\" + a +a); \n" +
+ " case A /*here*/a when a.toString().length()>2 -> System.out.println(\"A:\" + a +a); \n" +
" case B b -> System.out.println(\"B:\" + b);\n" +
" default -> System.out.println(\"Object\" + o);\n" +
" }\n" +
@@ -889,7 +889,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"private static void foo(Object o) {\n" +
" final int a=0; \n" +
" switch (o) {\n" +
- " case Integer i && a > 5 -> System.out.println(\"Integer:\" + /*here*/i);\n" +
+ " case Integer i when a > 5 -> System.out.println(\"Integer:\" + /*here*/i);\n" +
" case String s -> System.out.println(\"String:\" + s + s);\n" +
" default -> System.out.println(\"Object\" + o);\n" +
" }\n" +
@@ -926,7 +926,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"private static void foo(Object o) {\n" +
" final int a=0; \n" +
" switch (o) {\n" +
- " case Integer i && a > 5 -> System.out.println(\"Integer:\" + /*here*/i);\n" +
+ " case Integer i when a > 5 -> System.out.println(\"Integer:\" + /*here*/i);\n" +
" case String s -> System.out.println(\"String:\" + s + s);\n" +
" default -> System.out.println(\"Object\" + o);\n" +
" }\n" +
@@ -1257,7 +1257,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"private static void foo(Object o) {\n" +
" switch (o) {\n" +
" case Integer i -> System.out.println(\"Integer:\" + i);\n" +
- " case String s && /*here*/s.hashCode()>0 -> System.out.println(\"String:\" );\n" +
+ " case String s when /*here*/s.hashCode()>0 -> System.out.println(\"String:\" );\n" +
" default -> System.out.println(\"Object\" + o);\n" +
" }}\n" +
"}\n" +
@@ -1274,7 +1274,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
int length = selection.length();
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
+ assertEquals("incorrect no of elements", 1, elements.length);
assertTrue(elements[0] instanceof ILocalVariable);
} finally {
@@ -1293,7 +1293,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
" String myVar= new String();" +
" switch (o) {\n" +
" case Integer i -> System.out.println(\"Integer:\" + i);\n" +
- " case String s1 && s1 != myVar && 0 < /*here*/s1.length() -> System.out.println(s1 );\n" +
+ " case String s1 when s1 != myVar && 0 < /*here*/s1.length() -> System.out.println(s1 );\n" +
" default -> {\n" +
" String s1 = new String();\n" +
" System.out.println(s1);\n" +
@@ -1311,7 +1311,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
int start = str.indexOf(selection);
int length = selection.length();
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
+ assertEquals("incorrect no of elements", 1, elements.length);
assertTrue(elements[0] instanceof ILocalVariable);
search(elements[0], REFERENCES, EXACT_RULE);
assertSearchResults("src/X.java void X.foo(Object) [s1] EXACT_MATCH\n"
@@ -1334,7 +1334,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
" String myVar= new String();" +
" switch (o) {\n" +
" case Integer i -> System.out.println(\"Integer:\" + i);\n" +
- " case String s1 && /*here*/s1 != myVar && 0 < s1.length() -> System.out.println(s1 );\n" +
+ " case String s1 when /*here*/s1 != myVar && 0 < s1.length() -> System.out.println(s1 );\n" +
" default -> {\n" +
" String s1 = new String();\n" +
" System.out.println(s1);\n" +
@@ -1352,7 +1352,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
int start = str.indexOf(selection);
int length = selection.length();
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
+ assertEquals("incorrect no of elements", 1, elements.length);
assertTrue(elements[0] instanceof ILocalVariable);
search(elements[0], REFERENCES, EXACT_RULE);
assertSearchResults("src/X.java void X.foo(Object) [s1] EXACT_MATCH\n"
@@ -1375,7 +1375,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
" String myVar= new String();" +
" switch (o) {\n" +
" case Integer i -> System.out.println(\"Integer:\" + i);\n" +
- " case String s1 && s1 != myVar && 0 < s1.length() -> System.out.println(s1 );\n" +
+ " case String s1 when s1 != myVar && 0 < s1.length() -> System.out.println(s1 );\n" +
" default -> {\n" +
" String s1 = new String();\n" +
" System.out.println(/*here*/s1);\n" +
@@ -1393,7 +1393,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
int start = str.indexOf(selection);
int length = selection.length();
IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
- assertTrue(elements.length ==1);
+ assertEquals("incorrect no of elements", 1, elements.length);
assertTrue(elements[0] instanceof ILocalVariable);
search(elements[0], REFERENCES, EXACT_RULE);
assertSearchResults("src/X.java void X.foo(Object) [s1] EXACT_MATCH");
@@ -1449,7 +1449,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"}\n" +
"private static int foo(Object o) {\n" +
" return switch (o) {\n" +
- " case String strGP && (o instanceof String c3 && c3.length() > 0) && strGP.length() > 0 -> 0;\n" +
+ " case String strGP when (o instanceof String c3 && c3.length() > 0) && strGP.length() > 0 -> 0;\n" +
" default -> 0;\n" +
" };\n" +
" }\n" +
@@ -1487,7 +1487,7 @@ public class JavaSearchBugs17Tests extends AbstractJavaSearchTests {
"}\n" +
"private static int foo(Object o) {\n" +
" return switch (o) {\n" +
- " case String strGP && (o instanceof String c3 && c3.length() > 0) && strGP.length() > 0 -> 0;\n" +
+ " case String strGP when (o instanceof String c3 && c3.length() > 0) && strGP.length() > 0 -> 0;\n" +
" default -> 0;\n" +
" };\n" +
" }\n" +
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs19Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs19Tests.java
new file mode 100644
index 000000000..8b0c953ab
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs19Tests.java
@@ -0,0 +1,781 @@
+/*******************************************************************************
+ * Copyright (c) 2022 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
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.model;
+
+import java.io.IOException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.ILocalVariable;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.WorkingCopyOwner;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.ReferenceMatch;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.TypeReferenceMatch;
+import org.eclipse.jdt.internal.core.SourceType;
+
+import junit.framework.Test;
+
+public class JavaSearchBugs19Tests extends AbstractJavaSearchTests {
+
+ static {
+ // org.eclipse.jdt.internal.core.search.BasicSearchEngine.VERBOSE = true;
+ // TESTS_NUMBERS = new int[] { 19 };
+ // TESTS_RANGE = new int[] { 1, -1 };
+ // TESTS_NAMES = new String[] {"testBug542559_001"};
+ }
+
+ public JavaSearchBugs19Tests(String name) {
+ super(name);
+ this.endChar = "";
+ }
+
+ public static Test suite() {
+ return buildModelTestSuite(JavaSearchBugs19Tests.class, BYTECODE_DECLARATION_ORDER);
+ }
+
+ class TestCollector extends JavaSearchResultCollector {
+ public void acceptSearchMatch(SearchMatch searchMatch) throws CoreException {
+ super.acceptSearchMatch(searchMatch);
+ }
+ }
+
+ class ReferenceCollector extends JavaSearchResultCollector {
+ protected void writeLine() throws CoreException {
+ super.writeLine();
+ ReferenceMatch refMatch = (ReferenceMatch) this.match;
+ IJavaElement localElement = refMatch.getLocalElement();
+ if (localElement != null) {
+ this.line.append("+[");
+ if (localElement.getElementType() == IJavaElement.ANNOTATION) {
+ this.line.append('@');
+ this.line.append(localElement.getElementName());
+ this.line.append(" on ");
+ this.line.append(localElement.getParent().getElementName());
+ } else {
+ this.line.append(localElement.getElementName());
+ }
+ this.line.append(']');
+ }
+ }
+ }
+
+ class TypeReferenceCollector extends ReferenceCollector {
+ protected void writeLine() throws CoreException {
+ super.writeLine();
+ TypeReferenceMatch typeRefMatch = (TypeReferenceMatch) this.match;
+ IJavaElement[] others = typeRefMatch.getOtherElements();
+ int length = others == null ? 0 : others.length;
+ if (length > 0) {
+ this.line.append("+[");
+ for (int i = 0; i < length; i++) {
+ IJavaElement other = others[i];
+ if (i > 0)
+ this.line.append(',');
+ if (other.getElementType() == IJavaElement.ANNOTATION) {
+ this.line.append('@');
+ this.line.append(other.getElementName());
+ this.line.append(" on ");
+ this.line.append(other.getParent().getElementName());
+ } else {
+ this.line.append(other.getElementName());
+ }
+ }
+ this.line.append(']');
+ }
+ }
+ }
+
+ protected IJavaProject setUpJavaProject(final String projectName, String compliance, boolean useFullJCL)
+ throws CoreException, IOException {
+ // copy files in project from source workspace to target workspace
+ IJavaProject setUpJavaProject = super.setUpJavaProject(projectName, compliance, useFullJCL);
+ return setUpJavaProject;
+ }
+
+ IJavaSearchScope getJavaSearchScope() {
+ return SearchEngine.createJavaSearchScope(new IJavaProject[] { getJavaProject("JavaSearchBugs") });
+ }
+
+ IJavaSearchScope getJavaSearchScopeBugs(String packageName, boolean addSubpackages) throws JavaModelException {
+ if (packageName == null)
+ return getJavaSearchScope();
+ return getJavaSearchPackageScope("JavaSearchBugs", packageName, addSubpackages);
+ }
+
+ public ICompilationUnit getWorkingCopy(String path, String source) throws JavaModelException {
+ if (this.wcOwner == null) {
+ this.wcOwner = new WorkingCopyOwner() {
+ };
+ }
+ return getWorkingCopy(path, source, this.wcOwner);
+ }
+
+ @Override
+ public void setUpSuite() throws Exception {
+ super.setUpSuite();
+ JAVA_PROJECT = setUpJavaProject("JavaSearchBugs", "19");
+ }
+
+ public void tearDownSuite() throws Exception {
+ deleteProject("JavaSearchBugs");
+ super.tearDownSuite();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ this.resultCollector = new TestCollector();
+ this.resultCollector.showAccuracy(true);
+ }
+
+ // record pattern - just check if search for record pattern local declaration works as expected
+ public void testIssue215_001() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) /*here*/r11)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r11);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/r11";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.print(Rectangle) [r11] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+
+ // record pattern - just check if search for component in record pattern local declaration works as expected
+ public void testIssue215_002() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int /*here*/xyz, int y), Color c),\n"
+ + " ColoredPoint lr) r11)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + xyz);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/xyz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.print(Rectangle) [xyz] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - just check if all occurence search for record pattern local declaration works
+ public void testIssue215_003() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) /*here*/r11)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + r11);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/r11";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void X.print(Rectangle).r11 [r11] EXACT_MATCH\n"
+ + "src/X.java void X.print(Rectangle) [r11] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+
+ // record pattern - just check if all occurence search for component in record pattern local declaration works
+ public void testIssue215_004() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int /*here*/xyz, int y), Color c),\n"
+ + " ColoredPoint lr) r11)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + xyz);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/xyz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, ALL_OCCURRENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void X.print(Rectangle).xyz [xyz] EXACT_MATCH\n"
+ + "src/X.java void X.print(Rectangle) [xyz] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - if search for "valid record pattern and make the pattern variable available in switch expression" works
+ public void testIssue215_005() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) /*here*/r11 -> {\n"
+ + " System.out.println(r11);\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/r11";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.printLowerRight(Rectangle) [r11] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - if search for component in "valid record pattern and make the pattern variable available in switch expression" works
+ public void testIssue215_006() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int /*here*/xyz, int y), Color c),\n"
+ + " ColoredPoint lr) r11 -> {\n"
+ + " System.out.println(xyz);\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/xyz";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.printLowerRight(Rectangle) [xyz] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - if search for enum in "valid record pattern and make the pattern variable available in switch expression" works
+ public void testIssue215_007() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int xyz, int y), Color /*here*/c1),\n"
+ + " ColoredPoint lr) r11 -> {\n"
+ + " System.out.println(c1);\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/c1";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.printLowerRight(Rectangle) [c1] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - if search for record in "valid record pattern and make the pattern variable available in switch expression" works
+ public void testIssue215_008() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int xyz, int y), Color c1),\n"
+ + " ColoredPoint lr) r11 -> {\n"
+ + " System.out.println(c1);\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record /*here*/Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/Point";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ SourceType local = (SourceType) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.printLowerRight(Rectangle) [Point] EXACT_MATCH\n"
+ + "src/X.java void X.main(String[]) [Point] EXACT_MATCH\n"
+ + "src/X.java void X.main(String[]) [Point] EXACT_MATCH\n"
+ + "src/X.java ColoredPoint.p [Point] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - if search for another record in nested "valid record pattern and make the pattern variable available in switch expression" works
+ public void testIssue215_009() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int xyz, int y), Color c1),\n"
+ + " ColoredPoint lr) r11 -> {\n"
+ + " System.out.println(c1);\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record /*here*/Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record /*here*/ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/ColoredPoint";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ SourceType local = (SourceType) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.printLowerRight(Rectangle) [ColoredPoint] EXACT_MATCH\n"
+ + "src/X.java void X.printLowerRight(Rectangle) [ColoredPoint] EXACT_MATCH\n"
+ + "src/X.java void X.main(String[]) [ColoredPoint] EXACT_MATCH\n"
+ + "src/X.java void X.main(String[]) [ColoredPoint] EXACT_MATCH\n"
+ + "src/X.java Rectangle.upperLeft [ColoredPoint] EXACT_MATCH\n"
+ + "src/X.java Rectangle.lowerRight [ColoredPoint] EXACT_MATCH"
+ + "");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - if search for another record in nested "valid record pattern and make the pattern variable available in switch expression" works
+ public void testIssue215_010() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int xyz, int y), Color c1),\n"
+ + " ColoredPoint lr) r11 -> {\n"
+ + " System.out.println(c1);\n"
+ + " yield 1; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum /*here*/Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/Color";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ SourceType local = (SourceType) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.printLowerRight(Rectangle) [Color] EXACT_MATCH\n"
+ + "src/X.java void X.main(String[]) [Color] EXACT_MATCH\n"
+ + "src/X.java void X.main(String[]) [Color] EXACT_MATCH\n"
+ + "src/X.java ColoredPoint.c [Color] EXACT_MATCH"
+ + ""
+ + "");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - just check if all occurence search for record pattern local declaration works
+ public void testIssue215_011() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint /*here*/lr) r1 -> {\n"
+ + " System.out.println(\"x= \" + x);\n"
+ + " System.out.println(\"y= \" + y);\n"
+ + " System.out.println(\"lr= \" + lr);\n"
+ + " System.out.println(\"lr.c()= \" + lr.c());\n"
+ + " System.out.println(\"lr.p()= \" + lr.p());\n"
+ + " System.out.println(\"lr.p().x()= \" + lr.p().x());\n"
+ + " System.out.println(\"lr.p().y()= \" + lr.p().y());\n"
+ + " System.out.println(\"c= \" + c);\n"
+ + " System.out.println(\"r1= \" + r1);\n"
+ + " yield x; \n"
+ + " } \n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " System.out.println(\"Returns: \" + res);\n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/lr";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults(
+ "src/X.java void X.printLowerRight(Rectangle) [lr] EXACT_MATCH\n"
+ + "src/X.java void X.printLowerRight(Rectangle) [lr] EXACT_MATCH\n"
+ + "src/X.java void X.printLowerRight(Rectangle) [lr] EXACT_MATCH\n"
+ + "src/X.java void X.printLowerRight(Rectangle) [lr] EXACT_MATCH\n"
+ + "src/X.java void X.printLowerRight(Rectangle) [lr] EXACT_MATCH"
+ + "");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ // record pattern - just check if search for record pattern local declaration works - another example
+ public void testIssue215_0012() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "@SuppressWarnings(\"preview\")"
+ + "public class X {\n"
+ + " @SuppressWarnings(\"preview\")\n"
+ + " public static void print(Pair p) {\n"
+ + " if (p instanceof Pair(Teacher(Object n), Student(Object n1, Integer i)) /*here*/r1) { \n"
+ + " System.out.println(n1.getClass().getTypeName() + \":\" + n1 + \",\" + r1); \n"
+ + " System.out.println(\"MORE\" + r1);\n"
+ + " } else { \n"
+ + " System.out.println(\"ELSE\");\n"
+ + " } \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " print(new Pair(new Teacher(\"123\"), new Student(\"abc\", 10)));\n"
+ + " }\n"
+ + "}\n"
+ + "sealed interface Person permits Student, Teacher {\n"
+ + " String name();\n"
+ + "}\n"
+ + " record Student(String name, Integer id) implements Person {}\n"
+ + " record Teacher(String name) implements Person {}\n"
+ + " record Pair(Person s, Person s1) {}\n"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/r1";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, REFERENCES, EXACT_RULE);
+ assertSearchResults("src/X.java void X.print(Pair) [r1] EXACT_MATCH\n"
+ + "src/X.java void X.print(Pair) [r1] EXACT_MATCH"
+ + "");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ public void testIssue344_001() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + " if (r instanceof (Rectangle(ColoredPoint(Point(int x, int y), Color c),\n"
+ + " ColoredPoint lr) r11)) {\n"
+ + " System.out.println(\"Upper-left corner: \" + /*here*/lr);\n"
+ + " }\n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/lr";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, DECLARATIONS, EXACT_RULE);
+ assertSearchResults("src/X.java void X.print(Rectangle).lr [lr] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+ public void testIssue344_002() throws CoreException {
+ this.workingCopies = new ICompilationUnit[1];
+ this.workingCopies[0] = getWorkingCopy("/JavaSearchBugs/src/X.java",
+ "public class X {\n"
+ + " static void print(Rectangle r) {\n"
+ + "switch (r) {\n"
+ + "case Rectangle r1 when (r instanceof (Rectangle(ColoredPoint upperLeft2, ColoredPoint lowerRight) r2)):\n"
+ + " System.out.println( /*here*/upperLeft2);\n"
+ + " break;\n"
+ + " default :\n"
+ + " break;\n"
+ + " } \n"
+ + " }\n"
+ + " public static void main(String[] obj) {\n"
+ + " print(new Rectangle(new ColoredPoint(new Point(0, 0), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(10, 15), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}"
+ );
+ IJavaProject javaProject = this.workingCopies[0].getJavaProject(); // assuming single project for all
+ // working copies
+ String old = javaProject.getOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, true);
+ try {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ String str = this.workingCopies[0].getSource();
+ String selection = "/*here*/upperLeft2";
+ int start = str.indexOf(selection);
+ int length = selection.length();
+
+ IJavaElement[] elements = this.workingCopies[0].codeSelect(start, length);
+ ILocalVariable local = (ILocalVariable) elements[0];
+ search(local, DECLARATIONS, EXACT_RULE);
+ assertSearchResults("src/X.java void X.print(Rectangle).upperLeft2 [upperLeft2] EXACT_MATCH");
+ } finally {
+ javaProject.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, old);
+ }
+ }
+
+}
+
+
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java
index 1fa888a3c..d8bc39884 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchScopeTests.java
@@ -15,24 +15,41 @@ package org.eclipse.jdt.core.tests.model;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Arrays;
import java.util.HashMap;
-
-import junit.framework.Test;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.search.*;
+import org.eclipse.jdt.core.IClasspathContainer;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.tests.model.AbstractJavaSearchTests.JavaSearchResultCollector;
import org.eclipse.jdt.core.tests.model.AbstractJavaSearchTests.TypeNameMatchCollector;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.index.IndexLocation;
import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
+import junit.framework.Test;
+
/**
* Tests the Java search engine accross multiple projects.
*/
@@ -1124,4 +1141,68 @@ public void testBug397818() throws CoreException {
deleteProject("P1");
}
}
+/*
+ * Test that we can find methods in a type from a jar with modules,
+ * using a type in the JRE as an example.
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/332
+ */
+public void testModuleJarSearchBugGh332() throws Exception {
+ String testProjectName = "gh322ModuleJarSearchBug";
+ try {
+ IJavaProject project = setupModuleProject(testProjectName, new String[] {"src"}, new String[0], null);
+ waitForAutoBuild();
+ waitUntilIndexesReady();
+
+ JavaSearchResultCollector resultCollector = new JavaSearchResultCollector();
+ String timerTypeFqn = "java.util.Timer";
+ IType timerType = project.findType(timerTypeFqn);
+ assertNotNull("Failed to find JRE type: " + timerTypeFqn, timerType);
+ String methodName = "sched";
+ IMethod schedMethod = null;
+ for (IMethod method : timerType.getMethods()) {
+ if (methodName.equals(method.getElementName())) {
+ schedMethod = method;
+ }
+ }
+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { schedMethod.getAncestor(IJavaElement.PACKAGE_FRAGMENT) });
+ assertNotNull("Failed to find method: " + methodName + ", in JRE type: " + timerTypeFqn, schedMethod);
+ int agnosticMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH;
+ SearchPattern pattern = SearchPattern.createPattern(schedMethod, IJavaSearchConstants.REFERENCES, agnosticMatchRule);
+ SearchEngine searchEngine = new SearchEngine();
+ searchEngine.search(pattern, new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, scope, resultCollector, new NullProgressMonitor());
+
+ String foundReferences = resultCollector.toString();
+ assertFalse("Expected search to find references of method: " + schedMethod, foundReferences.isEmpty());
+ List<String> results = Arrays.asList(foundReferences.split("\n"));
+ String[] expectedResults = {
+ "void java.util.Timer.schedule(java.util.TimerTask, long)",
+ "void java.util.Timer.schedule(java.util.TimerTask, java.util.Date)",
+ "void java.util.Timer.schedule(java.util.TimerTask, long, long)",
+ "void java.util.Timer.schedule(java.util.TimerTask, java.util.Date, long)",
+ "void java.util.Timer.scheduleAtFixedRate(java.util.TimerTask, long, long)",
+ "void java.util.Timer.scheduleAtFixedRate(java.util.TimerTask, java.util.Date, long)",
+ };
+ assertEquals("Unexpected search results:\n" + foundReferences, expectedResults.length, results.size());
+ Set<String> notFound = new LinkedHashSet<>();
+ notFound.addAll(Arrays.asList(expectedResults));
+ for (String expectedResult : expectedResults) {
+ boolean isFound = false;
+ for (String match : results) {
+ if (match.contains(expectedResult)) {
+ isFound = true;
+ break;
+ }
+ }
+ if (isFound) {
+ notFound.remove(expectedResult);
+ }
+ }
+ assertTrue("Unexpected search result\nExpected:\n" + String.join("\n", expectedResults) + "\nActual:\n" + foundReferences + "\nExpected but not found:\n" + String.join("\n", notFound),
+ notFound.isEmpty());
+ } finally {
+ JavaCore.setOptions(getDefaultJavaCoreOptions());
+ deleteProject(testProjectName);
+ }
+}
+
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java
index ea06598f2..a7e0b41ef 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java
@@ -16,8 +16,10 @@ package org.eclipse.jdt.core.tests.model;
import java.io.File;
import java.io.IOException;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Hashtable;
+import java.util.List;
import junit.framework.Test;
@@ -26,6 +28,7 @@ import org.eclipse.core.runtime.*;
import org.eclipse.jdt.core.*;
import org.eclipse.jdt.core.search.*;
import org.eclipse.jdt.core.tests.util.Util;
+import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
import org.eclipse.jdt.internal.core.JavaModelStatus;
/**
@@ -4503,5 +4506,214 @@ public void testBug383908() throws CoreException {
deleteProject("P");
}
}
+/*
+ * Test that we can find methods called in an anonymous type from a jar,
+ * if the primary type contains multiple anonymous types.
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/375
+ */
+public void testAnonymousTypeMethodReferenceJarSearchGh375() throws Exception {
+ try {
+ IJavaProject project = createJavaProject("P", new String[] { "src" }, new String[] { "/P/libGh375.jar", "JCL18_LIB" }, "bin", "1.8");
+ createFile(
+ "/P/src/X.java",
+ "public class X {\n" +
+ " @SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n" +
+ " public static void main(String[] args) {\n" +
+ " IY y = s -> foo(0);\n" +
+ " y.accept(0);\n" +
+ " }\n" +
+ " static private void foo(int i) {}\n" +
+ "}\n"
+ );
+ String libSource = String.join(System.lineSeparator(), new String[] {
+ "public class TestGh375 {",
+ " public void foo() {",
+ " Runnable r = new Runnable() {",
+ " @Override",
+ " public void run() {",
+ " System.out.println(\"foo\");",
+ " }",
+ " };",
+ " r.run();",
+ " }",
+ " public void bar() throws Exception {",
+ " java.util.concurrent.Callable<Void> r = new java.util.concurrent.Callable<Void>() {",
+ " @Override",
+ " public Void call() {",
+ " System.out.println(\"bar\");",
+ " helloWorld();",
+ " return null;",
+ " }",
+ " };",
+ " r.call();",
+ " }",
+ " public void helloWorld() {",
+ " System.out.println(\"hello world\");",
+ " }",
+ "}",
+ });
+
+ String jarFileName = "libGh375.jar";
+ String srcZipName = "libGh375.src.zip";
+ createLibrary(project, jarFileName, srcZipName, new String[] { "TestGh375.java", libSource}, new String[0], JavaCore.VERSION_1_8);
+ IFile srcZip = (IFile) project.getProject().findMember(srcZipName);
+ IFile jar = (IFile) project.getProject().findMember(jarFileName);
+ JarPackageFragmentRoot root = (JarPackageFragmentRoot) project.getPackageFragmentRoot(jar);
+ root.attachSource(srcZip.getFullPath(), null, null);
+ waitUntilIndexesReady();
+
+ IMethod testMethod = findMethod(project, "TestGh375", "helloWorld");
+ String foundReferences = searchForMethodReferences(testMethod);
+ assertFalse("Expected search to find references of method: " + testMethod + ", in snippet:\n" + libSource, foundReferences.isEmpty());
+ List<String> results = Arrays.asList(foundReferences.split(System.lineSeparator()));
+ String[] expectedResults = {
+ "call() (not open) [in <anonymous> [in TestGh375$2.class [in <default> [in libGh375.jar [in P]]]]]",
+ };
+ assertEquals("Unexpected search result", String.join(System.lineSeparator(), expectedResults), String.join(System.lineSeparator(), results));
+ } finally {
+ JavaCore.setOptions(getDefaultJavaCoreOptions());
+ deleteProject("P");
+ }
+}
+/*
+ * Test that we can find method references called in an anonymous type defined in a method.
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/432
+ */
+public void testAnonymousTypeMethodReferenceSearchGh432() throws Exception {
+ String testProjectName = "gh432MethodReferencesSearchBug";
+ String snippet1 = "package p;\n" +
+ "public class TestGh432 {\n" +
+ " public static void main(String[] args) {\n" +
+ " class R implements Runnable {\n" +
+ " public void run() {\n" +
+ " java.util.stream.Stream.empty().filter(TestGh432::missingReference).count();\n" +
+ " }\n" +
+ " }\n" +
+ " new R().run();\n" +
+ " }\n" +
+ " public static boolean missingReference(Object arg) {\n" +
+ " return true;\n" +
+ " }\n" +
+ "}";
+ String snippet2 = "package p;\n" +
+ "public class TestGh432 {\n" +
+ " private static void foo(Runnable r) {\n" +
+ " r.run();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " foo(new Runnable() {\n" +
+ " public void run() {\n" +
+ " java.util.stream.Stream.empty().filter(TestGh432::missingReference).count();\n" +
+ " }\n" +
+ " });\n" +
+ " }\n" +
+ " public static boolean missingReference(Object arg) {\n" +
+ " return true;\n" +
+ " }\n" +
+ "}";
+ String snippet3 = "package p;\n" +
+ "public class TestGh432 {\n" +
+ " public static void main(String[] args) {\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " java.util.stream.Stream.empty().filter(TestGh432::missingReference).count();\n" +
+ " }\n" +
+ " }.run();\n" +
+ " }\n" +
+ " }.run();\n" +
+ " }\n" +
+ " public static boolean missingReference(Object arg) {\n" +
+ " return true;\n" +
+ " }\n" +
+ "}";
+ String snippet4 = "package p;\n" +
+ "public class TestGh432 {\n" +
+ " private static void foo(Runnable r) {\n" +
+ " r.run();\n" +
+ " }\n" +
+ " public static void main(String[] args) {\n" +
+ " foo(() -> {\n" +
+ " new Runnable() {\n" +
+ " public void run() {\n" +
+ " java.util.stream.Stream.empty().filter(TestGh432::missingReference).count();\n" +
+ " }\n" +
+ " };\n" +
+ " });\n" +
+ " }\n" +
+ " public static boolean missingReference(Object arg) {\n" +
+ " return true;\n" +
+ " }\n" +
+ "}";
+ String[] testSnippets = {
+ snippet1,
+ snippet2,
+ snippet3,
+ snippet4,
+ };
+ String[] expectedMatches = {
+ "void run() {key=Lp/TestGh432$89$R;.run()V} [in R [in main(String[]) [in TestGh432 [in TestGh432.java [in p [in src [in gh432MethodReferencesSearchBug]]]]]]]",
+ "void run() {key=Lp/TestGh432$148;.run()V} [in <anonymous #1> [in main(String[]) [in TestGh432 [in TestGh432.java [in p [in src [in gh432MethodReferencesSearchBug]]]]]]]",
+ "void run() {key=Lp/TestGh432$138;.run()V} [in <anonymous #1> [in run() [in <anonymous #1> [in main(String[]) [in TestGh432 [in TestGh432.java [in p [in src [in gh432MethodReferencesSearchBug]]]]]]]]]",
+ "run() (not open) {key=Lp/TestGh432$162;.run()V} [in <anonymous #1> [in run() [in <lambda #1> [in main(String[]) [in TestGh432 [in TestGh432.java [in p [in src [in gh432MethodReferencesSearchBug]]]]]]]]]",
+ };
+ try {
+ IJavaProject p = createJava11Project(testProjectName, new String[] {"src"});
+ waitUntilIndexesReady();
+ String packageFolder = "/" + testProjectName + "/src/p";
+ createFolder(packageFolder);
+ String sourceFile = packageFolder + "/TestGh432.java";
+ waitForAutoBuild();
+ for (int i = 0; i < testSnippets.length; ++i) {
+ String fileContent = testSnippets[i];
+ String expectedResults = expectedMatches[i];
+ deleteFile(sourceFile);
+ waitForAutoBuild();
+ waitUntilIndexesReady();
+ createFile(sourceFile, fileContent);
+ waitForAutoBuild();
+ waitUntilIndexesReady();
+
+ IMethod testMethod = findMethod(p, "p.TestGh432", "missingReference");
+ String foundReferences = searchForMethodReferences(testMethod).strip();
+ assertFalse("Expected search to find references of method: " + testMethod + ", in snippet:\n" + fileContent, foundReferences.isEmpty());
+ List<String> results = Arrays.asList(foundReferences.split("\n"));
+ assertEquals("Unexpected search result for snippet:\n" + fileContent, expectedResults, String.join("\n", results));
+ }
+ } finally {
+ JavaCore.setOptions(getDefaultJavaCoreOptions());
+ deleteProject(testProjectName);
+ }
+}
+private static String searchForMethodReferences(IMethod testMethod) throws CoreException {
+ class JavaSearchResultCollector extends SearchRequestor {
+ private final StringBuilder result = new StringBuilder();
+ public void acceptSearchMatch(SearchMatch match) throws CoreException {
+ JavaSearchResultCollector.this.result.append(match.getElement());
+ JavaSearchResultCollector.this.result.append(System.lineSeparator());
+ }
+ }
+ JavaSearchResultCollector testResultCollector = new JavaSearchResultCollector();
+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { testMethod.getAncestor(IJavaElement.PACKAGE_FRAGMENT) });
+ int agnosticMatchRule = SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE | SearchPattern.R_ERASURE_MATCH;
+ SearchPattern pattern = SearchPattern.createPattern(testMethod, IJavaSearchConstants.REFERENCES, agnosticMatchRule);
+ SearchEngine searchEngine = new SearchEngine();
+ searchEngine.search(pattern, new SearchParticipant[] {SearchEngine.getDefaultSearchParticipant()}, scope, testResultCollector, new NullProgressMonitor());
+ String foundReferences = testResultCollector.result.toString();
+ return foundReferences;
+}
+private static IMethod findMethod(IJavaProject project, String typeFqn, String methodName) throws JavaModelException {
+ IType testType = project.findType(typeFqn);
+ assertNotNull("Failed to find test type: " + typeFqn, testType);
+ IMethod testMethod = null;
+ for (IMethod method : testType.getMethods()) {
+ if (methodName.equals(method.getElementName())) {
+ testMethod = method;
+ }
+ }
+ assertNotNull("Failed to find method: " + methodName + ", in type: " + typeFqn, testMethod);
+ return testMethod;
+}
}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleOptionsTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleOptionsTests.java
index efc17db5b..d4063ae03 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleOptionsTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ModuleOptionsTests.java
@@ -425,7 +425,7 @@ public class ModuleOptionsTests extends ModifyingResourceTests {
markers = p2.getProject().findMarkers(null, true, IResource.DEPTH_INFINITE);
assertMarkers("Unexpected markers",
"The project was not built since its build path is incomplete. Cannot find the class file for org.astro.World. Fix the build path then try building this project\n" +
- "The type org.astro.World cannot be resolved. It is indirectly referenced from required .class files",
+ "The type org.astro.World cannot be resolved. It is indirectly referenced from required type one.p.C",
markers);
} finally {
deleteExternalResource(libPath);
@@ -497,7 +497,7 @@ public class ModuleOptionsTests extends ModifyingResourceTests {
IMarker[] markers = p2.getProject().findMarkers(null, true, IResource.DEPTH_INFINITE);
assertMarkers("Unexpected markers",
"The project was not built since its build path is incomplete. Cannot find the class file for org.astro.World. Fix the build path then try building this project\n" +
- "The type org.astro.World cannot be resolved. It is indirectly referenced from required .class files",
+ "The type org.astro.World cannot be resolved. It is indirectly referenced from required type one.p.C",
markers);
IClasspathAttribute[] attrs = new IClasspathAttribute[] {
JavaCore.newClasspathAttribute(IClasspathAttribute.MODULE, "true"),
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
index c0f9b6bed..79b4e6b93 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ReconcilerTests.java
@@ -18,6 +18,7 @@ package org.eclipse.jdt.core.tests.model;
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
@@ -44,6 +45,8 @@ import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.tests.util.Util;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.jdt.internal.core.CompilationUnit;
+import org.eclipse.jdt.internal.core.JavaElement;
+import org.eclipse.jdt.internal.core.JavaModelCache;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
import org.osgi.framework.Bundle;
@@ -2466,6 +2469,47 @@ public void testMethodWithError07() throws CoreException {
deleteFile("/Reconciler/src/p1/Y.java");
}
}
+
+/** tests that after closing a workingcopy all elements are removed from JavaModelCache**/
+public void testCloseMethodArgumentChildren() throws Exception {
+ this.workingCopy.discardWorkingCopy();
+ this.workingCopy = null;
+ try {
+ String contents = "package p1;\n" + "public class Y {\n" + " void foo(int i) {\n" + " }\n" + "}";
+ createFile("/Reconciler/src/p1/Y.java", contents);
+ this.problemRequestor = new ProblemRequestor();
+ this.problemRequestor.initialize(contents.toCharArray());
+ WorkingCopyOwner owner = new WorkingCopyOwner(){};
+
+ long owningCount0 = getCachedElementCount(owner);
+ // Create working copy
+ this.workingCopy = getCompilationUnit("Reconciler/src/p1/Y.java").getWorkingCopy(owner, null);
+ // Close working copy
+ long owningCount1 = getCachedElementCount(owner);
+ assertTrue(owningCount1 - owningCount0 > 0);
+ JavaModelManager.getJavaModelManager().removeInfoAndChildren((CompilationUnit) this.workingCopy);
+ long owningCount2 = getCachedElementCount(owner);
+ assertEquals(0, owningCount2 - owningCount0); // did fail with 1 element (the method argument)
+ assertEquals(0, owningCount0);
+ assertEquals(0, owningCount2);
+ } finally {
+ deleteFile("/Reconciler/src/p1/Y.java");
+ }
+}
+private static long getCachedElementCount(WorkingCopyOwner owner) throws Exception {
+ JavaModelManager javaModelManager = JavaModelManager.getJavaModelManager();
+ // private JavaModelCache javaModelCache=javaModelManager.cache:
+ Field cacheField = javaModelManager.getClass().getDeclaredField("cache");
+ cacheField.setAccessible(true);
+ JavaModelCache javaModelCache = (JavaModelCache) cacheField.get(javaModelManager);
+ // private Map<IJavaElement, Object> childrenCache=javaModelCache.childrenCache:
+ Field childrenCacheField = javaModelCache.getClass().getDeclaredField("childrenCache");
+ childrenCacheField.setAccessible(true);
+ Map<IJavaElement, Object> childrenCache = (Map<IJavaElement, Object>) childrenCacheField.get(javaModelCache);
+ return childrenCache.keySet().stream()
+ .filter(je -> ((((JavaElement) je).getCompilationUnit()==null)?null:((JavaElement) je).getCompilationUnit().getOwner()) == owner).count();
+}
+
/*
* Test that the units with similar names aren't presenting each other errors
* (regression test for bug 39475)
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordPatternTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordPatternTest.java
new file mode 100644
index 000000000..81909d733
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingRecordPatternTest.java
@@ -0,0 +1,586 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.rewrite.describing;
+
+import java.util.List;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.GuardedPattern;
+import org.eclipse.jdt.core.dom.InfixExpression;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.NullPattern;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.RecordPattern;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.SwitchCase;
+import org.eclipse.jdt.core.dom.SwitchExpression;
+import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypePattern;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.dom.YieldStatement;
+import org.eclipse.jdt.core.dom.rewrite.ASTRewrite;
+import org.eclipse.jdt.core.dom.rewrite.ListRewrite;
+
+import junit.framework.Test;
+
+@SuppressWarnings({"rawtypes", "deprecation"})
+public class ASTRewritingRecordPatternTest extends ASTRewritingTest {
+
+
+ public ASTRewritingRecordPatternTest(String name, int apiLevel) {
+ super(name, apiLevel);
+ }
+
+ public static Test suite() {
+ return createSuite(ASTRewritingRecordPatternTest.class, 19);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (this.apiLevel == AST.JLS19 ) { // Remove this after it is a standard feature
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
+ }
+ }
+
+ private boolean checkAPILevel() {
+ if (this.apiLevel < 19) {
+ System.err.println("Test "+getName()+" requires a JRE 19");
+ return true;
+ }
+ return false;
+ }
+
+
+ public void testAddRecordSwitchPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String buf = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "printLowerRight");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // insert record pattern
+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)blockStatements.get(0);
+
+ VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment)variableDeclarationStatement.fragments().get(0);
+ SwitchExpression switchExpression= (SwitchExpression) variableDeclarationFragment.getInitializer();
+ List statements= switchExpression.statements();
+ assertTrue("Number of statements not 2", statements.size() == 2);
+
+ SwitchCase caseStatement= ast.newSwitchCase();
+ caseStatement.setSwitchLabeledRule(true);
+ RecordPattern recordPattern = ast.newRecordPattern();
+ recordPattern.setPatternName(ast.newSimpleName("r1"));
+ recordPattern.setPatternType(ast.newSimpleType(ast.newSimpleName("Rectangle")));
+ caseStatement.expressions().add(recordPattern);
+ ListRewrite listRewrite= rewrite.getListRewrite(switchExpression, SwitchExpression.STATEMENTS_PROPERTY);
+ listRewrite.insertAt(caseStatement, 0, null);
+ Block block1 = ast.newBlock();
+ YieldStatement yieldStatement = ast.newYieldStatement();
+ yieldStatement.setExpression(ast.newNumberLiteral("1"));
+ block1.statements().add(yieldStatement);
+ listRewrite.insertAt(block1, 1, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle r1 -> {\n"
+ + " yield 1;\n"
+ + "}\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testModifyRecordSwitchPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String buf = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint clr) r1 -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft) {}";
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "printLowerRight");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // Modify Record pattern
+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)blockStatements.get(0);
+
+ VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment)variableDeclarationStatement.fragments().get(0);
+ SwitchExpression switchExpression= (SwitchExpression) variableDeclarationFragment.getInitializer();
+ List statements= switchExpression.statements();
+ SwitchCase caseStatement = (SwitchCase)statements.get(0);
+ RecordPattern recordPatternR = (RecordPattern)(caseStatement.expressions().get(0));
+ RecordPattern recordPatternC = ast.newRecordPattern();
+ recordPatternC.setPatternName(ast.newSimpleName("clr1"));
+ recordPatternC.setPatternType(ast.newSimpleType(ast.newSimpleName("ColoredPoint")));
+ ListRewrite listRewrite= rewrite.getListRewrite(recordPatternR, RecordPattern.PATTERNS_PROPERTY);
+ listRewrite.insertAt(recordPatternC, 0, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle(ColoredPoint clr1, ColoredPoint clr) r1 -> {\n"
+ + " yield 1;\n"
+ + " }\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft) {}";
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void testRemoveRecordSwitchPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ String buf = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " case Rectangle r1 -> {\n"
+ + " yield 1;\n"
+ + "}\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "printLowerRight");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // insert record pattern
+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)blockStatements.get(0);
+
+ VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment)variableDeclarationStatement.fragments().get(0);
+ SwitchExpression switchExpression= (SwitchExpression) variableDeclarationFragment.getInitializer();
+ List statements= switchExpression.statements();
+ assertTrue("Number of statements not 1", statements.size() == 4);
+
+
+ rewrite.remove((ASTNode) statements.get(0), null);
+ rewrite.remove((ASTNode) statements.get(1), null);
+ }
+
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf = "public class X {\n"
+ + " public static void printLowerRight(Rectangle r) {\n"
+ + " int res = switch(r) {\n"
+ + " default -> 0;\n"
+ + " }; \n"
+ + " }\n"
+ + " public static void main(String[] args) {\n"
+ + " printLowerRight(new Rectangle(new ColoredPoint(new Point(15, 5), Color.BLUE), \n"
+ + " new ColoredPoint(new Point(30, 10), Color.RED)));\n"
+ + " }\n"
+ + "}\n"
+ + "record Point(int x, int y) {}\n"
+ + "enum Color { RED, GREEN, BLUE }\n"
+ + "record ColoredPoint(Point p, Color c) {}\n"
+ + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}";
+
+ assertEqualString(preview, buf.toString());
+ }
+
+
+ public void _testAddRecordInstanceOfPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuilder buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " switch (o) {\n");
+ buf.append( " default : System.out.println(\"0\");\n");
+ buf.append( " }\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // insert Guarded pattern
+ SwitchStatement switchStatement = (SwitchStatement) blockStatements.get(0);
+
+ List statements= switchStatement.statements();
+ assertTrue("Number of statements not 2", statements.size() == 2);
+
+ SwitchCase caseStatement= ast.newSwitchCase();
+ caseStatement.setSwitchLabeledRule(false);
+ GuardedPattern guardedPattern = ast.newGuardedPattern();
+ TypePattern typePattern = ast.newTypePattern();
+ SingleVariableDeclaration patternVariable = ast.newSingleVariableDeclaration();
+ patternVariable.setType(ast.newSimpleType(ast.newSimpleName("Integer")));
+ patternVariable.setName(ast.newSimpleName("i"));
+ typePattern.setPatternVariable(patternVariable);
+ guardedPattern.setPattern(typePattern);
+ InfixExpression infixExpression = ast.newInfixExpression();
+ infixExpression.setOperator(InfixExpression.Operator.GREATER);
+ infixExpression.setLeftOperand(ast.newSimpleName("i"));
+ infixExpression.setRightOperand(ast.newNumberLiteral("10"));//$NON-NLS
+ guardedPattern.setExpression(infixExpression);
+ caseStatement.expressions().add(guardedPattern);
+
+ ListRewrite listRewrite= rewrite.getListRewrite(switchStatement, SwitchStatement.STATEMENTS_PROPERTY);
+ listRewrite.insertAt(caseStatement, 0, null);
+
+ MethodInvocation methodInvocation = ast.newMethodInvocation();
+ QualifiedName name =
+ ast.newQualifiedName(
+ ast.newSimpleName("System"),//$NON-NLS-1$
+ ast.newSimpleName("out"));//$NON-NLS-1$
+ methodInvocation.setExpression(name);
+ methodInvocation.setName(ast.newSimpleName("println")); //$NON-NLS-1$
+ StringLiteral stringLiteral = ast.newStringLiteral();
+ stringLiteral.setLiteralValue("Greater than 10");//$NON-NLS-1$
+ methodInvocation.arguments().add(stringLiteral);//$NON-NLS-1$
+ ExpressionStatement expressionStatement = ast.newExpressionStatement(methodInvocation);
+ listRewrite.insertAt(expressionStatement, 1, null);
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " switch (o) {\n");
+ buf.append( " case Integer i when i > 10:\n");
+ buf.append( " System.out.println(\"Greater than 10\");\n");
+ buf.append( " default : System.out.println(\"0\");\n");
+ buf.append( " }\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void _testModifyGuardedPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuilder buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " switch (o) {\n");
+ buf.append( " case String s when s.equals(\"hi\") : System.out.println(\"hi\");\n");
+ buf.append( " default : System.out.println(\"0\");\n");
+ buf.append( " }\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // replace Guarded pattern
+ SwitchStatement switchStatement = (SwitchStatement) blockStatements.get(0);
+
+ List statements= switchStatement.statements();
+ assertTrue("Number of statements not 4", statements.size() == 4);
+
+ SwitchCase caseStatement= (SwitchCase)statements.get(0);
+ GuardedPattern guardedPattern = ast.newGuardedPattern();
+ TypePattern typePattern = ast.newTypePattern();
+ SingleVariableDeclaration patternVariable = ast.newSingleVariableDeclaration();
+ patternVariable.setType(ast.newSimpleType(ast.newSimpleName("Integer")));
+ patternVariable.setName(ast.newSimpleName("i"));
+ typePattern.setPatternVariable(patternVariable);
+ guardedPattern.setPattern(typePattern);
+ InfixExpression infixExpression = ast.newInfixExpression();
+ infixExpression.setOperator(InfixExpression.Operator.GREATER);
+ infixExpression.setLeftOperand(ast.newSimpleName("i"));
+ infixExpression.setRightOperand(ast.newNumberLiteral("10"));//$NON-NLS
+ guardedPattern.setExpression(infixExpression);
+ rewrite.replace((ASTNode) caseStatement.expressions().get(0),guardedPattern, null);
+
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " switch (o) {\n");
+ buf.append( " case Integer i when i > 10 : System.out.println(\"hi\");\n");
+ buf.append( " default : System.out.println(\"0\");\n");
+ buf.append( " }\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void _testRemoveRecordInstanceOfPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuilder buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " int i = switch (o) {\n");
+ buf.append( " case Integer i when i > 10 : System.out.println(\"hi\");\n");
+ buf.append( " case String s when s.equals(\"hi\") : System.out.println(\"hi\");\n");
+ buf.append( " default -> 0;\n");
+ buf.append( " };\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // remove guarded pattern statement
+ VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)blockStatements.get(0);
+
+ VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment)variableDeclarationStatement.fragments().get(0);
+ SwitchExpression switchStatement= (SwitchExpression) variableDeclarationFragment.getInitializer();
+ List statements= switchStatement.statements();
+ assertTrue("Number of statements not 6", statements.size() == 6);
+
+ // remove statements
+
+ rewrite.remove((ASTNode) statements.get(0), null);
+ rewrite.remove((ASTNode) statements.get(1), null);
+ }
+
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " int i = switch (o) {\n");
+ buf.append( " case String s when s.equals(\"hi\") : System.out.println(\"hi\");\n");
+ buf.append( " default -> 0;\n");
+ buf.append( " };\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+ public void _testModifyRecordInstanceOfPattern() throws Exception {
+ if (checkAPILevel()) {
+ return;
+ }
+ IPackageFragment pack1= this.sourceFolder.createPackageFragment("test1", false, null);
+ StringBuilder buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " switch (o) {\n");
+ buf.append( " case Integer i -> System.out.println(\"Integer\");\n");
+ buf.append( " default -> 0;\n");
+ buf.append( " }\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+
+ ICompilationUnit cu= pack1.createCompilationUnit("X.java", buf.toString(), false, null);
+
+ CompilationUnit astRoot= createAST(this.apiLevel, cu);
+ ASTRewrite rewrite= ASTRewrite.create(astRoot.getAST());
+
+ AST ast= astRoot.getAST();
+
+ assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);
+ TypeDeclaration type= findTypeDeclaration(astRoot, "X");
+ MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");
+ Block block= methodDecl.getBody();
+ List blockStatements= block.statements();
+ assertTrue("Number of statements not 1", blockStatements.size() == 1);
+ { // insert null pattern
+ SwitchStatement switchStatement = (SwitchStatement) blockStatements.get(0);
+
+ List statements= switchStatement.statements();
+ assertTrue("Number of statements not 4", statements.size() == 4);
+
+ SwitchCase caseStatement= ast.newSwitchCase();
+ caseStatement.setSwitchLabeledRule(true);
+ NullPattern nullPattern = ast.newNullPattern();
+ caseStatement.expressions().add(nullPattern);
+
+ ListRewrite listRewrite= rewrite.getListRewrite(switchStatement, SwitchStatement.STATEMENTS_PROPERTY);
+ listRewrite.insertAt(caseStatement, 2, null);
+
+ MethodInvocation methodInvocation = ast.newMethodInvocation();
+ QualifiedName name =
+ ast.newQualifiedName(
+ ast.newSimpleName("System"),//$NON-NLS-1$
+ ast.newSimpleName("out"));//$NON-NLS-1$
+ methodInvocation.setExpression(name);
+ methodInvocation.setName(ast.newSimpleName("println")); //$NON-NLS-1$
+ StringLiteral stringLiteral = ast.newStringLiteral();
+ stringLiteral.setLiteralValue("Null");//$NON-NLS-1$
+ methodInvocation.arguments().add(stringLiteral);//$NON-NLS-1$
+ ExpressionStatement expressionStatement = ast.newExpressionStatement(methodInvocation);
+ listRewrite.insertAt(expressionStatement, 3, null);
+ }
+
+ String preview= evaluateRewrite(cu, rewrite);
+
+ buf= new StringBuilder();
+ buf.append("public class X {\n");
+ buf.append( "void foo(Object o) {\n");
+ buf.append( " switch (o) {\n");
+ buf.append( " case Integer i -> System.out.println(\"Integer\");\n");
+ buf.append( " case null -> System.out.println(\"Null\");\n");
+ buf.append( " default -> 0;\n");
+ buf.append( " }\n");
+ buf.append( "}\n");
+ buf.append( "\n");
+ buf.append( "}\n");
+ assertEqualString(preview, buf.toString());
+ }
+
+}
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchPatternTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchPatternTest.java
index 69789a424..897f042f1 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchPatternTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingSwitchPatternTest.java
@@ -53,23 +53,23 @@ public class ASTRewritingSwitchPatternTest extends ASTRewritingTest {
}
public static Test suite() {
- return createSuite(ASTRewritingSwitchPatternTest.class, 18);
+ return createSuite(ASTRewritingSwitchPatternTest.class, 19);
}
@Override
protected void setUp() throws Exception {
super.setUp();
- if (this.apiLevel == AST.JLS18 ) { // Remove this after it is a standard feature
- this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_18);
- this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_18);
- this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_18);
+ if (this.apiLevel == AST.JLS19 ) { // Remove this after it is a standard feature
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_19);
this.project1.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.ENABLED);
}
}
private boolean checkAPILevel() {
- if (this.apiLevel < 18) {
- System.err.println("Test "+getName()+" requires a JRE 18");
+ if (this.apiLevel < 19) {
+ System.err.println("Test "+getName()+" requires a JRE 19");
return true;
}
return false;
@@ -342,7 +342,7 @@ public class ASTRewritingSwitchPatternTest extends ASTRewritingTest {
buf.append("public class X {\n");
buf.append( "void foo(Object o) {\n");
buf.append( " switch (o) {\n");
- buf.append( " case Integer i && i > 10:\n");
+ buf.append( " case Integer i when i > 10:\n");
buf.append( " System.out.println(\"Greater than 10\");\n");
buf.append( " default : System.out.println(\"0\");\n");
buf.append( " }\n");
@@ -361,7 +361,7 @@ public class ASTRewritingSwitchPatternTest extends ASTRewritingTest {
buf.append("public class X {\n");
buf.append( "void foo(Object o) {\n");
buf.append( " switch (o) {\n");
- buf.append( " case String s && s.equals(\"hi\") : System.out.println(\"hi\");\n");
+ buf.append( " case String s when s.equals(\"hi\") : System.out.println(\"hi\");\n");
buf.append( " default : System.out.println(\"0\");\n");
buf.append( " }\n");
buf.append( "}\n");
@@ -410,7 +410,7 @@ public class ASTRewritingSwitchPatternTest extends ASTRewritingTest {
buf.append("public class X {\n");
buf.append( "void foo(Object o) {\n");
buf.append( " switch (o) {\n");
- buf.append( " case Integer i && i > 10 : System.out.println(\"hi\");\n");
+ buf.append( " case Integer i when i > 10 : System.out.println(\"hi\");\n");
buf.append( " default : System.out.println(\"0\");\n");
buf.append( " }\n");
buf.append( "}\n");
@@ -428,8 +428,8 @@ public class ASTRewritingSwitchPatternTest extends ASTRewritingTest {
buf.append("public class X {\n");
buf.append( "void foo(Object o) {\n");
buf.append( " int i = switch (o) {\n");
- buf.append( " case Integer i && i > 10 : System.out.println(\"hi\");\n");
- buf.append( " case String s && s.equals(\"hi\") : System.out.println(\"hi\");\n");
+ buf.append( " case Integer i when i > 10 : System.out.println(\"hi\");\n");
+ buf.append( " case String s when s.equals(\"hi\") : System.out.println(\"hi\");\n");
buf.append( " default -> 0;\n");
buf.append( " };\n");
buf.append( "}\n");
@@ -468,7 +468,7 @@ public class ASTRewritingSwitchPatternTest extends ASTRewritingTest {
buf.append("public class X {\n");
buf.append( "void foo(Object o) {\n");
buf.append( " int i = switch (o) {\n");
- buf.append( " case String s && s.equals(\"hi\") : System.out.println(\"hi\");\n");
+ buf.append( " case String s when s.equals(\"hi\") : System.out.println(\"hi\");\n");
buf.append( " default -> 0;\n");
buf.append( " };\n");
buf.append( "}\n");
diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
index 0ce6f37b2..cfaab12fb 100644
--- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
+++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/rewrite/describing/ASTRewritingTest.java
@@ -95,9 +95,12 @@ public class ASTRewritingTest extends AbstractJavaModelTests {
/** @deprecated using deprecated code */
private final static int JLS17_INTERNAL = AST.JLS17;
+ /** @deprecated using deprecated code */
private final static int JLS18_INTERNAL = AST.JLS18;
- private final static int[] JLS_LEVELS = { JLS2_INTERNAL, JLS3_INTERNAL, JLS4_INTERNAL, JLS8_INTERNAL, JLS9_INTERNAL, JLS10_INTERNAL, JLS14_INTERNAL, JLS15_INTERNAL, JLS16_INTERNAL, JLS17_INTERNAL, JLS18_INTERNAL};
+ private final static int JLS19_INTERNAL = AST.JLS19;
+
+ private final static int[] JLS_LEVELS = { JLS2_INTERNAL, JLS3_INTERNAL, JLS4_INTERNAL, JLS8_INTERNAL, JLS9_INTERNAL, JLS10_INTERNAL, JLS14_INTERNAL, JLS15_INTERNAL, JLS16_INTERNAL, JLS17_INTERNAL, JLS18_INTERNAL, JLS19_INTERNAL};
private static final String ONLY_AST_STRING = "_only";
private static final String SINCE_AST_STRING = "_since";
@@ -157,6 +160,7 @@ public class ASTRewritingTest extends AbstractJavaModelTests {
suite.addTest(ASTRewritingLambdaExpressionTest.suite());
suite.addTest(ASTRewritingReferenceExpressionTest.suite());
suite.addTest(ASTRewritingRecordDeclarationTest.suite());
+ suite.addTest(ASTRewritingRecordPatternTest.suite());
suite.addTest(ASTRewritingInstanceOfPatternExpressionTest.suite());
suite.addTest(SourceModifierTest.suite());
suite.addTest(ImportRewriteTest.suite());
@@ -272,12 +276,21 @@ public class ASTRewritingTest extends AbstractJavaModelTests {
setUpProjectAbove18();
}
+ @SuppressWarnings("deprecation")
protected void setUpProjectAbove18() throws Exception {
if (this.apiLevel == AST_INTERNAL_JLS18 ) {
this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_18);
this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_18);
this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_18);
}
+ setUpProjectAbove19();
+ }
+ protected void setUpProjectAbove19() throws Exception {
+ if (this.apiLevel == AST_INTERNAL_JLS19 ) {
+ this.project1.setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_19);
+ this.project1.setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_19);
+ }
}
protected IJavaProject createProject(String projectName, String complianceVersion) throws CoreException {
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_19/.classpath b/org.eclipse.jdt.core.tests.model/workspace/Converter_19/.classpath
new file mode 100644
index 000000000..f1c0852b2
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_19/.classpath
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="var" path="CONVERTER_JCL_19_LIB" sourcepath="CONVERTER_JCL_19_SRC" rootpath="CONVERTER_JCL_SRCROOT"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_19/.project b/org.eclipse.jdt.core.tests.model/workspace/Converter_19/.project
new file mode 100644
index 000000000..99cff2823
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_19/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>Converter_19</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Converter_19/src/X.java b/org.eclipse.jdt.core.tests.model/workspace/Converter_19/src/X.java
new file mode 100644
index 000000000..fa1d49312
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Converter_19/src/X.java
@@ -0,0 +1,4 @@
+public class X {
+ public void foo(X this) {
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.core/.settings/.api_filters b/org.eclipse.jdt.core/.settings/.api_filters
index 1cc28c666..991dde5cc 100644
--- a/org.eclipse.jdt.core/.settings/.api_filters
+++ b/org.eclipse.jdt.core/.settings/.api_filters
@@ -9,7 +9,16 @@
</message_arguments>
</filter>
</resource>
- <resource path="dom/org/eclipse/jdt/core/dom/AbstractTextElement.java" type="org.eclipse.jdt.core.dom.AbstractTextElement">
+ <resource path="dom/org/eclipse/jdt/core/dom/AST.java" type="org.eclipse.jdt.core.dom.AST">
+ <filter id="388194388">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.AST"/>
+ <message_argument value="JLS_Latest"/>
+ <message_argument value="18"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/AbstractTagElement.java" type="org.eclipse.jdt.core.dom.AbstractTagElement">
<filter id="576725006">
<message_arguments>
<message_argument value="IDocElement"/>
@@ -249,6 +258,14 @@
</message_arguments>
</filter>
</resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/GuardedPattern.java" type="org.eclipse.jdt.core.dom.GuardedPattern">
+ <filter comment="Removed for preview feature Java 19" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.GuardedPattern"/>
+ <message_argument value="patternVariables()"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="dom/org/eclipse/jdt/core/dom/TagProperty.java" type="org.eclipse.jdt.core.dom.Property">
<filter id="576725006">
<message_arguments>
@@ -292,4 +309,20 @@
</message_arguments>
</filter>
</resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/Modifier.java" type="org.eclipse.jdt.core.dom.Modifier$ModifierKeyword">
+ <filter id="336658481">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.Modifier.ModifierKeyword"/>
+ <message_argument value="WHEN_KEYWORD"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="dom/org/eclipse/jdt/core/dom/NullPattern.java" type="org.eclipse.jdt.core.dom.NullPattern">
+ <filter comment="Removed for preview feature Java 19" id="338792546">
+ <message_arguments>
+ <message_argument value="org.eclipse.jdt.core.dom.NullPattern"/>
+ <message_argument value="patternVariables()"/>
+ </message_arguments>
+ </filter>
+ </resource>
</component>
diff --git a/org.eclipse.jdt.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
index cd7b56556..f65e0e7d9 100644
--- a/org.eclipse.jdt.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.core; singleton:=true
-Bundle-Version: 3.31.0.OTDT_r282_qualifier
+Bundle-Version: 3.32.0.OTDT_r282_qualifier
Bundle-Activator: org.eclipse.jdt.core.JavaCore
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -78,7 +78,7 @@ Export-Package: org.eclipse.jdt.core,
org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.transformer;x-internal:=true,
org.eclipse.objectteams.otdt.internal.core.compiler.util;x-internal:=true,
org.eclipse.objectteams.otdt.internal.core.util;x-internal:=true
-Require-Bundle: org.eclipse.core.resources;bundle-version="[3.17.0,4.0.0)",
+Require-Bundle: org.eclipse.core.resources;bundle-version="[3.18.0,4.0.0)",
org.eclipse.core.runtime;bundle-version="[3.13.0,4.0.0)",
org.eclipse.core.filesystem;bundle-version="[1.7.0,2.0.0)",
org.eclipse.text;bundle-version="[3.6.0,4.0.0)",
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
index d855a542b..a747f9f9e 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java
@@ -215,7 +215,7 @@ public class Main implements ProblemSeverities, SuffixConstants {
private static final String INFO = "INFO"; //$NON-NLS-1$
public static final int XML = 1;
- private static final String XML_DTD_DECLARATION = "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.006 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_006.dtd\">"; //$NON-NLS-1$
+ private static final String XML_DTD_DECLARATION = "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.006 Compiler//EN\" \"https://www.eclipse.org/jdt/core/compiler_32_006.dtd\">"; //$NON-NLS-1$
static {
try {
Class<?> c = IProblem.class;
@@ -3262,6 +3262,9 @@ private String optionStringToVersion(String currentArg) {
case "18": //$NON-NLS-1$
case "18.0": //$NON-NLS-1$
return CompilerOptions.VERSION_18;
+ case "19": //$NON-NLS-1$
+ case "19.0": //$NON-NLS-1$
+ return CompilerOptions.VERSION_19;
default:
return null;
}
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 42567248b..172ecef79 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
@@ -72,7 +72,7 @@ configure.duplicateTarget = duplicate target compliance setting specification: {
configure.unsupportedReleaseOption = option --release is supported only when run with JDK 9 or above
configure.unsupportedWithRelease = option {0} is not supported when --release is used
configure.unsupportedReleaseVersion = release version {0} is not supported
-configure.source = source level should be in ''1.1''...''1.8'',''9''...''18'' (or ''5.0''..''18.0''): {0}
+configure.source = source level should be in ''1.1''...''1.8'',''9''...''19'' (or ''5.0''..''19.0''): {0}
configure.invalidSystem = invalid location for system libraries: {0}
configure.unsupportedOption = option {0} not supported at compliance level 9 and above
configure.duplicateOutputPath = duplicate output path specification: {0}
@@ -90,7 +90,7 @@ configure.invalidDebugOption = invalid debug option: {0}
configure.invalidWarningConfiguration = invalid warning configuration: ''{0}''
configure.invalidWarning = invalid warning token: ''{0}''. Ignoring warning and compiling
configure.invalidWarningOption = invalid warning option: ''{0}''. Must specify a warning token
-configure.targetJDK = target level should be in ''1.1''...''1.8'',''9''...''18'' (or ''5.0''..''18.0'') or cldc1.1: {0}
+configure.targetJDK = target level should be in ''1.1''...''1.8'',''9''...''19'' (or ''5.0''..''19.0'') or cldc1.1: {0}
configure.incompatibleTargetForSource = Target level ''{0}'' is incompatible with source level ''{1}''. A target level ''{1}'' or better is required
configure.incompatibleTargetForGenericSource = Target level ''{0}'' is incompatible with source level ''{1}''. A source level ''1.5'' or better is required
configure.incompatibleComplianceForSource = Compliance level ''{0}'' is incompatible with source level ''{1}''. A compliance level ''{1}'' or better is required
@@ -263,9 +263,10 @@ misc.usage = {1} {2}\n\
\ -16 -16.0 use 16 compliance (-source 16 -target 16)\n\
\ -17 -17.0 use 17 compliance (-source 17 -target 17)\n\
\ -18 -18.0 use 18 compliance (-source 18 -target 18)\n\
-\ -source <version> set source level: 1.3 to 1.9, 10 to 18\n\
+\ -19 -19.0 use 19 compliance (-source 19 -target 19)\n\
+\ -source <version> set source level: 1.3 to 1.9, 10 to 19\n\
\ (or 6, 6.0, etc)\n\
-\ -target <version> set classfile target: 1.3 to 1.9, 10 to 18\n\
+\ -target <version> set classfile target: 1.3 to 1.9, 10 to 19\n\
\ (or 6, 6.0, etc)\n\
\ cldc1.1 can also be used to generate the StackMap\n\
\ attribute\n\
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
index dd2b8dd75..74d435bfb 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java
@@ -8,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -1776,7 +1777,7 @@ private boolean checkInstanceofKeyword() {
private boolean checkYieldKeyword() {
// Clients to ensure that we are already inside a method
char[] id = this.scanner.getCurrentIdentifierSource();
- if(id.length > 0 && CharOperation.prefixEquals(id, Keywords.YIELD)) {
+ if(id.length > 0 && CharOperation.equals(id, Keywords.YIELD)) {
return true;
}
return false;
@@ -4553,6 +4554,9 @@ protected void consumeToken(int token) {
// YieldStatement and thus not producing accurate completion, but completion doesn't have
// enough information anyway about the LHS anyway.
token = this.currentToken = this.getNextToken();
+ if(token == TokenNameIntegerLiteral && this.previousToken == TokenNameIdentifier ) {
+ token = this.currentToken = this.getNextToken();
+ }
super.consumeToken(this.currentToken);
}
if (previous == TokenNameDOT) { // e.g. foo().[fred]()
@@ -5652,6 +5656,9 @@ boolean computeKeywords(int kind, List<char[]> keywords) {
keywords.add(Keywords.TRUE);
keywords.add(Keywords.FALSE);
keywords.add(Keywords.NULL);
+ if (this.options.complianceLevel >= ClassFileConstants.JDK19) {
+ keywords.add(Keywords.WHEN);
+ }
if (kind == K_YIELD_KEYWORD) {
keywords.add(Keywords.YIELD);
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
index 43960cf3b..b501a13a3 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java
@@ -1870,7 +1870,7 @@ protected void consumeParameterMappingOut() {
*/
protected int indexOfAssistIdentifier(boolean useGenericsStack){
- if (this.identifierLengthPtr < 0){
+ if (this.identifierLengthPtr < 0 || this.identifierPtr < 0 ){
return -1; // no awaiting identifier
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
index 2567de696..a42f61e61 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java
@@ -8,6 +8,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -88,8 +89,8 @@ public interface Keywords {
char[] RESULT = "result".toCharArray(); //$NON-NLS-1$
// these are special: include subsequent '()':
char[] BASE_WHEN = "base when ()".toCharArray(); //$NON-NLS-1$
- char[] WHEN = "when ()".toCharArray(); //$NON-NLS-1$
//gbr}
char[] VAR = "var".toCharArray(); //$NON-NLS-1$ // Admittedly not a full blown keyword, just "reserved"
+ char[] WHEN = "when".toCharArray(); //$NON-NLS-1$ // Admittedly not a full blown keyword, just "reserved"
}
diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
index c7f58e771..884b4b370 100644
--- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
+++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java
@@ -846,6 +846,45 @@ protected void consumeInstanceOfExpression() {
}
}
@Override
+protected Expression consumePatternInsideInstanceof(Pattern pattern) {
+ if(pattern instanceof RecordPattern) {
+ pushLocalVariableFromRecordPatternOnAstStack((RecordPattern)pattern);
+ }
+ return super.consumePatternInsideInstanceof(pattern);
+}
+
+@Override
+protected void consumeCaseLabelElement(CaseLabelKind kind) {
+ super.consumeCaseLabelElement(kind);
+ switch (kind) {
+ case CASE_PATTERN: {
+ ASTNode[] ps = this.patternStack;
+ if (ps[0] instanceof RecordPattern) {
+ pushLocalVariableFromRecordPatternOnAstStack((RecordPattern) ps[0]);
+ }
+ }
+ break;
+ default:
+ break;
+
+ }
+}
+
+private void pushLocalVariableFromRecordPatternOnAstStack(RecordPattern rp) {
+ Pattern[] patterns = rp.patterns;
+ for (Pattern pattern : patterns) {
+ if (pattern instanceof RecordPattern)
+ pushLocalVariableFromRecordPatternOnAstStack((RecordPattern) pattern);
+ else {
+ LocalDeclaration patternVariable = pattern.getPatternVariable();
+ if (patternVariable != null)
+ pushOnAstStack(patternVariable);
+
+ }
+ }
+}
+
+@Override
protected void consumeInstanceOfExpressionWithName() {
int length = this.patternLengthPtr >= 0 ?
this.patternLengthStack[this.patternLengthPtr--] : 0;
@@ -855,12 +894,13 @@ protected void consumeInstanceOfExpressionWithName() {
if (this.expressionStack[this.expressionPtr] != this.assistNode) {
// Push only when the selection node is not the expression of this
// pattern matching instanceof expression
- LocalDeclaration patternVariableIntroduced = pattern.getPatternVariableIntroduced();
+ LocalDeclaration patternVariableIntroduced = pattern.getPatternVariable();
if (patternVariableIntroduced != null) {
// filter out patternVariableIntroduced based on current selection if there is an assist node
if (this.assistNode == null || (this.selectionStart <= patternVariableIntroduced.sourceStart
&& this.selectionEnd >= patternVariableIntroduced.sourceEnd)) {
- pushOnAstStack(patternVariableIntroduced);
+ if(!(pattern instanceof RecordPattern))
+ pushOnAstStack(patternVariableIntroduced);
}
}
if ((this.selectionStart >= pattern.sourceStart)
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 ab436f6ca..da18a80c9 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
@@ -815,7 +815,7 @@ void setSourceStart(int sourceStart);
int PackageCollidesWithType = TypeRelated + 321;
int TypeCollidesWithPackage = TypeRelated + 322;
int DuplicateTypes = TypeRelated + 323;
- int IsClassPathCorrect = TypeRelated + 324;
+ int IsClassPathCorrect = TypeRelated + 324; // see also IsClasspathCorrectWithReferencingType below
int PublicClassMustMatchFileName = TypeRelated + 325;
/** @deprecated - problem is no longer generated */
int MustSpecifyPackage = Internal + 326;
@@ -862,6 +862,8 @@ void setSourceStart(int sourceStart);
int IllegalVisibilityModifierCombinationForField = FieldRelated + 344;
int IllegalModifierCombinationFinalVolatileForField = FieldRelated + 345;
int UnexpectedStaticModifierForField = FieldRelated + 346;
+ /** @since 3.32 */
+ int IsClassPathCorrectWithReferencingType = TypeRelated + 347;
/** @deprecated - problem is no longer generated, use {@link #UndefinedType} instead */
int FieldTypeNotFound = FieldRelated + 349 + ProblemReasons.NotFound; // FieldRelated + 350
@@ -1942,6 +1944,8 @@ void setSourceStart(int sourceStart);
int AnnotatedTypeArgumentToUnannotated = Internal + 983;
/** @since 3.21 */
int AnnotatedTypeArgumentToUnannotatedSuperHint = Internal + 984;
+ /** @since 3.32 */
+ int NonNullArrayContentNotInitialized = Internal + 985;
// Java 8 work
@@ -2873,6 +2877,7 @@ void setSourceStart(int sourceStart);
*/
int PatternVariableRedefined = Internal + 1781;
/** @since 3.26
+ * @deprecated
*/
int PatternSubtypeOfExpression = Internal + 1782;
/** @since 3.26
@@ -2966,4 +2971,24 @@ void setSourceStart(int sourceStart);
/** @since 3.28
* @noreference preview feature error */
int UnexpectedTypeinSwitchPattern = PreviewRelated + 1911;
+ /**
+ * @since 3.32
+ * @noreference preview feature
+ */
+ int UnexpectedTypeinRecordPattern = PreviewRelated + 1912;
+ /**
+ * @since 3.32
+ * @noreference preview feature
+ */
+ int RecordPatternMismatch = PreviewRelated + 1913;
+ /**
+ * @since 3.32
+ * @noreference preview feature
+ */
+ int PatternTypeMismatch = PreviewRelated + 1914;
+ /**
+ * @since 3.32
+ * @noreference preview feature
+ */
+ int RawTypeInRecordPattern = PreviewRelated + 1915;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
index 062a4921d..cdfcd48bf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -345,6 +345,7 @@ public abstract class ASTNode implements TypeConstants, TypeIds {
public static final Argument [] NO_ARGUMENTS = new Argument [0];
public static final RecordComponent [] NO_RECORD_COMPONENTS = new RecordComponent [0];
+ public static final TypePattern[] NO_TYPE_PATTERNS = new TypePattern[0];
public ASTNode() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
index d648bd315..570b61b85 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java
@@ -190,30 +190,40 @@ public class ArrayAllocationExpression extends Expression {
&& (referenceType.tagBits & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK)
{
scope.problemReporter().contradictoryNullAnnotations(this.type.annotations[this.type.annotations.length-1]);
+ referenceType = referenceType.withoutToplevelNullAnnotation();
}
//{ObjectTeams:
referenceType = RoleTypeCreator.maybeWrapUnqualifiedRoleType(referenceType, scope, this);
// SH}
this.resolvedType = scope.createArrayType(referenceType, this.dimensions.length);
+ int lastInitializedDim = -1;
+ long[] nullTagBitsPerDimension = null;
if (this.annotationsOnDimensions != null) {
this.resolvedType = resolveAnnotations(scope, this.annotationsOnDimensions, this.resolvedType);
- long[] nullTagBitsPerDimension = ((ArrayBinding)this.resolvedType).nullTagBitsPerDimension;
+ nullTagBitsPerDimension = ((ArrayBinding)this.resolvedType).nullTagBitsPerDimension;
if (nullTagBitsPerDimension != null) {
for (int i = 0; i < this.annotationsOnDimensions.length; i++) {
if ((nullTagBitsPerDimension[i] & TagBits.AnnotationNullMASK) == TagBits.AnnotationNullMASK) {
scope.problemReporter().contradictoryNullAnnotations(this.annotationsOnDimensions[i]);
nullTagBitsPerDimension[i] = 0;
}
+ if (this.dimensions[i] != null) {
+ lastInitializedDim = i;
+ }
}
}
}
- // check the initializer
if (this.initializer != null) {
this.resolvedType = ArrayTypeReference.maybeMarkArrayContentsNonNull(scope, this.resolvedType, this.sourceStart, this.dimensions.length, null);
if ((this.initializer.resolveTypeExpecting(scope, this.resolvedType)) != null)
this.initializer.binding = (ArrayBinding)this.resolvedType;
+ } else {
+ // check uninitialized cells declared @NonNull inside the last initialized dimension
+ if (lastInitializedDim != -1 && nullTagBitsPerDimension != null) {
+ checkUninitializedNonNullArrayContents(scope, nullTagBitsPerDimension[lastInitializedDim+1], lastInitializedDim);
+ }
}
if ((referenceType.tagBits & TagBits.HasMissingType) != 0) {
return null;
@@ -222,6 +232,21 @@ public class ArrayAllocationExpression extends Expression {
return this.resolvedType;
}
+ protected void checkUninitializedNonNullArrayContents(BlockScope scope, long elementNullTagBits, int lastDim) {
+ if ((elementNullTagBits & TagBits.AnnotationNonNull) == 0)
+ return; // next element type admits 'null' entries
+ if (this.dimensions[lastDim] instanceof IntLiteral) {
+ Constant intConstant = ((IntLiteral) this.dimensions[lastDim]).constant;
+ if (intConstant.intValue() == 0)
+ return; // last dimension [0] implies no 'null' entries
+ }
+ TypeBinding elementType = this.resolvedType;
+ for (int i=0; i<lastDim+1; i++) {
+ elementType = ((ArrayBinding) elementType).elementsType();
+ }
+ scope.problemReporter().nonNullArrayContentNotInitialized(this.dimensions[lastDim], scope.environment(), elementType);
+ }
+
@Override
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
index af46adcbe..5163fb11c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java
@@ -1814,6 +1814,14 @@ public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output
}
@Override
+public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ this.addPatternVariablesWhenTrue(variables);
+ this.left.addPatternVariablesWhenTrue(variables);
+ this.left.collectPatternVariablesToScope(variables, scope);
+ this.right.addPatternVariablesWhenTrue(variables);
+ this.right.collectPatternVariablesToScope(variables, scope);
+}
+@Override
public void addPatternVariables(BlockScope scope, CodeStream codeStream) {
this.left.addPatternVariables(scope, codeStream);
this.right.addPatternVariables(scope, codeStream);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
index 604f51fe7..52295122b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java
@@ -159,8 +159,10 @@ private void casePatternExpressionGenerateCode(BlockScope currentScope, CodeStre
if (this.patternIndex != -1) {
LocalVariableBinding local = currentScope.findVariable(SwitchStatement.SecretPatternVariableName, null);
codeStream.load(local);
- Pattern patternExpression = ((Pattern) this.constantExpressions[this.patternIndex]);
- patternExpression.generateCode(currentScope, codeStream);
+ Pattern pattern = ((Pattern) this.constantExpressions[this.patternIndex]);
+ pattern.generateCode(currentScope, codeStream);
+ if (!(pattern instanceof GuardedPattern))
+ codeStream.goto_(pattern.thenTarget);
}
}
@@ -458,7 +460,7 @@ private Constant resolveConstantExpression(BlockScope scope,
TypeBinding pb = e.resolveAtType(scope, switchStatement.expression.resolvedType);
if (pb != null) switchStatement.caseLabelElementTypes.add(pb);
TypeBinding expressionType = switchStatement.expression.resolvedType;
- LocalDeclaration patternVar = e.getPatternVariableIntroduced();
+ LocalDeclaration patternVar = e.getPatternVariable();
if (patternVar != null && !patternVar.type.isTypeNameVar(scope)) {
// The following code is copied from InstanceOfExpression#resolve()
// But there are enough differences to warrant a copy
@@ -507,7 +509,7 @@ private Constant resolveConstantExpression(BlockScope scope,
e.traverse(new ASTVisitor() {
@Override
public boolean visit(TypePattern typePattern, BlockScope scope) {
- LocalDeclaration local = typePattern.getPatternVariableIntroduced();
+ LocalDeclaration local = typePattern.getPatternVariable();
if (local != null && local.binding != null)
codeStream.removeVariable(local.binding);
return false; // No deeper than this on this node
@@ -535,7 +537,7 @@ public void traverse(ASTVisitor visitor, BlockScope blockScope) {
*/
public LocalDeclaration getLocalDeclaration() {
Expression cexp = this.constantExpressions[this.patternIndex];
- LocalDeclaration patternVariableIntroduced = cexp.getPatternVariableIntroduced();
+ LocalDeclaration patternVariableIntroduced = cexp.getPatternVariable();
return patternVariableIntroduced;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
index ddb82c149..194f5c0b0 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java
@@ -490,14 +490,14 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext,
if (!this.condition.containsPatternVariable()) {
return;
}
- if (this.condition.getPatternVariableIntroduced() != null) {
- char[] name = this.condition.getPatternVariableIntroduced().name;
- LocalDeclaration localVar = this.valueIfTrue.getPatternVariableIntroduced();
+ if (this.condition.getPatternVariable() != null) {
+ char[] name = this.condition.getPatternVariable().name;
+ LocalDeclaration localVar = this.valueIfTrue.getPatternVariable();
if (localVar != null && CharOperation.equals(name, localVar.name)) {
scope.problemReporter().illegalRedeclarationOfPatternVar(localVar.binding, localVar);
return;
}
- localVar = this.valueIfFalse.getPatternVariableIntroduced();
+ localVar = this.valueIfFalse.getPatternVariable();
if (localVar != null && CharOperation.equals(name, localVar.name)) {
scope.problemReporter().illegalRedeclarationOfPatternVar(localVar.binding, localVar);
return;
@@ -709,9 +709,9 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext,
// >= 1.5 : LUB(operand types) must exist
TypeBinding commonType = null;
if (valueIfTrueType == TypeBinding.NULL) {
- commonType = valueIfFalseType;
+ commonType = valueIfFalseType.withoutToplevelNullAnnotation(); // null on other branch invalidates any @NonNull
} else if (valueIfFalseType == TypeBinding.NULL) {
- commonType = valueIfTrueType;
+ commonType = valueIfTrueType.withoutToplevelNullAnnotation(); // null on other branch invalidates any @NonNull
} else {
commonType = scope.lowerUpperBound(new TypeBinding[] { valueIfTrueType, valueIfFalseType });
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
index ed27af017..cf43c8f38 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java
@@ -984,7 +984,7 @@ public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean
public void addPatternVariables(BlockScope scope, CodeStream codeStream) {
// Nothing by default
}
-public LocalDeclaration getPatternVariableIntroduced() {
+public LocalDeclaration getPatternVariable() {
return null;
}
public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/GuardedPattern.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/GuardedPattern.java
index 7472546cc..53933bbe8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/GuardedPattern.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/GuardedPattern.java
@@ -27,9 +27,9 @@ public class GuardedPattern extends Pattern {
public Pattern primaryPattern;
public Expression condition;
- /* package */ BranchLabel thenTarget;
int thenInitStateIndex1 = -1;
int thenInitStateIndex2 = -1;
+ public int restrictedIdentifierStart = -1; // used only for 'when' restricted keyword.
public GuardedPattern(Pattern primaryPattern, Expression conditionalAndExpression) {
this.primaryPattern = primaryPattern;
@@ -46,8 +46,8 @@ public class GuardedPattern extends Pattern {
}
@Override
- public LocalDeclaration getPatternVariableIntroduced() {
- return this.primaryPattern.getPatternVariableIntroduced();
+ public LocalDeclaration getPatternVariable() {
+ return this.primaryPattern.getPatternVariable();
}
@Override
@@ -61,11 +61,12 @@ public class GuardedPattern extends Pattern {
}
@Override
- public void generateCode(BlockScope currentScope, CodeStream codeStream) {
- this.primaryPattern.generateCode(currentScope, codeStream);
-
- Constant cst = this.condition.optimizedBooleanConstant();
+ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel) {
this.thenTarget = new BranchLabel(codeStream);
+ this.elseTarget = new BranchLabel(codeStream);
+ this.primaryPattern.generateOptimizedBoolean(currentScope, codeStream, this.thenTarget, this.elseTarget);
+ Constant cst = this.condition.optimizedBooleanConstant();
+
this.condition.generateOptimizedBoolean(
currentScope,
codeStream,
@@ -78,13 +79,14 @@ public class GuardedPattern extends Pattern {
}
}
- public boolean isGuardTrueAlways() {
+ @Override
+ public boolean isAlwaysTrue() {
Constant cst = this.condition.optimizedBooleanConstant();
return cst != Constant.NotAConstant && cst.booleanValue() == true;
}
@Override
public boolean isTotalForType(TypeBinding type) {
- return this.primaryPattern.isTotalForType(type) && isGuardTrueAlways();
+ return this.primaryPattern.isTotalForType(type) && isAlwaysTrue();
}
@Override
public Pattern primary() {
@@ -108,8 +110,8 @@ public class GuardedPattern extends Pattern {
return this.resolvedType;
this.resolvedType = this.primaryPattern.resolveType(scope);
this.condition.resolveType(scope);
- LocalDeclaration PatternVar = this.primaryPattern.getPatternVariableIntroduced();
- LocalVariableBinding lvb = PatternVar.binding;
+ LocalDeclaration PatternVar = this.primaryPattern.getPatternVariable();
+ LocalVariableBinding lvb = PatternVar == null ? null : PatternVar.binding;
this.condition.traverse(new ASTVisitor() {
@Override
public boolean visit(
@@ -137,7 +139,7 @@ public class GuardedPattern extends Pattern {
@Override
public StringBuffer printExpression(int indent, StringBuffer output) {
- this.primaryPattern.print(indent, output).append(" && "); //$NON-NLS-1$
+ this.primaryPattern.print(indent, output).append(" when "); //$NON-NLS-1$
return this.condition.print(indent, output);
}
@@ -151,10 +153,31 @@ public class GuardedPattern extends Pattern {
}
visitor.endVisit(this, scope);
}
+ @Override
public void suspendVariables(CodeStream codeStream, BlockScope scope) {
codeStream.removeNotDefinitelyAssignedVariables(scope, this.thenInitStateIndex1);
+ this.primaryPattern.suspendVariables(codeStream, scope);
}
+ @Override
public void resumeVariables(CodeStream codeStream, BlockScope scope) {
codeStream.addDefinitelyAssignedVariables(scope, this.thenInitStateIndex2);
+ this.primaryPattern.resumeVariables(codeStream, scope);
+ }
+ @Override
+ public void resolveWithExpression(BlockScope scope, Expression expression) {
+ this.primaryPattern.resolveWithExpression(scope, expression);
+ }
+ @Override
+ protected boolean isPatternTypeCompatible(TypeBinding other, BlockScope scope) {
+ return this.primaryPattern.isPatternTypeCompatible(other, scope);
+ }
+ @Override
+ public void wrapupGeneration(CodeStream codeStream) {
+ this.primaryPattern.wrapupGeneration(codeStream);
+ }
+ @Override
+ protected void generatePatternVariable(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel,
+ BranchLabel falseLabel) {
+ this.primaryPattern.generatePatternVariable(currentScope, codeStream, trueLabel, falseLabel);
}
}
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 03943d979..d733efeb5 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -26,7 +26,6 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
-import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationPosition;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
@@ -61,6 +60,7 @@ public class InstanceOfExpression extends OperatorExpression {
public Expression expression;
public TypeReference type;
public LocalDeclaration elementVariable;
+ public Pattern pattern;
static final char[] SECRET_INSTANCEOF_PATTERN_EXPRESSION_VALUE = " instanceOfPatternExpressionValue".toCharArray(); //$NON-NLS-1$
public LocalVariableBinding secretInstanceOfPatternExpressionValue = null;
@@ -80,13 +80,12 @@ public InstanceOfExpression(Expression expression, TypeReference type) {
}
public InstanceOfExpression(Expression expression, Pattern pattern) {
this.expression = expression;
- // As of now, instanceof can only have a type pattern variable.
- // So, extract the local variable definition and ignore the pattern
- this.elementVariable = pattern.getPatternVariableIntroduced();
- this.type = this.elementVariable.type;
+ this.pattern = pattern;
+ this.elementVariable = pattern.getPatternVariable();
+ this.type = pattern.getType();
this.bits |= INSTANCEOF << OperatorSHIFT;
this.sourceStart = expression.sourceStart;
- this.sourceEnd = this.elementVariable.declarationSourceEnd;
+ this.sourceEnd = this.pattern.sourceEnd;
}
@Override
@@ -123,6 +122,10 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl
}
if (this.elementVariable != null) {
initsWhenTrue.markAsDefinitelyAssigned(this.elementVariable.binding);
+ initsWhenTrue.markAsDefinitelyNonNull(this.elementVariable.binding);
+ }
+ if (this.pattern != null) {
+ this.pattern.analyseCode(currentScope, flowContext, (initsWhenTrue == null) ? flowInfo : initsWhenTrue);
}
return (initsWhenTrue == null) ? flowInfo :
FlowInfo.conditional(initsWhenTrue, flowInfo.copy());
@@ -208,7 +211,7 @@ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStr
// a label valued to nil means: by default we fall through the case...
// both nil means we leave the value on the stack
- if (this.elementVariable == null) {
+ if (this.elementVariable == null && this.pattern == null) {
super.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel, valueRequired);
return;
}
@@ -222,17 +225,22 @@ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStr
BranchLabel nextSibling = falseLabel != null ? falseLabel : new BranchLabel(codeStream);
codeStream.instance_of(this.type, this.type.resolvedType);
- if (this.elementVariable != null) {
- codeStream.ifeq(nextSibling);
+ codeStream.ifeq(nextSibling);
+ codeStream.load(this.secretInstanceOfPatternExpressionValue);
+ if (this.pattern instanceof RecordPattern) {
+ this.pattern.generateOptimizedBoolean(currentScope, codeStream, trueLabel, nextSibling);
codeStream.load(this.secretInstanceOfPatternExpressionValue);
codeStream.checkcast(this.type, this.type.resolvedType, codeStream.position);
+ } else {
+ codeStream.checkcast(this.type, this.type.resolvedType, codeStream.position);
codeStream.dup();
codeStream.store(this.elementVariable.binding, false);
-
- codeStream.load(this.secretInstanceOfPatternExpressionValue);
- codeStream.removeVariable(this.secretInstanceOfPatternExpressionValue);
- codeStream.checkcast(this.type, this.type.resolvedType, codeStream.position);
}
+
+ codeStream.load(this.secretInstanceOfPatternExpressionValue);
+ codeStream.removeVariable(this.secretInstanceOfPatternExpressionValue);
+ codeStream.checkcast(this.type, this.type.resolvedType, codeStream.position);
+
if (valueRequired && cst == Constant.NotAConstant) {
codeStream.generateImplicitConversion(this.implicitConversion);
} else {
@@ -304,7 +312,7 @@ private void addAssignment(BlockScope currentScope, CodeStream codeStream, Local
@Override
public StringBuffer printExpressionNoParenthesis(int indent, StringBuffer output) {
this.expression.printExpression(indent, output).append(" instanceof "); //$NON-NLS-1$
- return this.elementVariable == null ? this.type.print(0, output) : this.elementVariable.printAsExpression(0, output);
+ return this.pattern == null ? this.type.print(0, output) : this.pattern.printExpression(0, output);
}
@Override
@@ -314,49 +322,37 @@ public void addPatternVariables(BlockScope currentScope, CodeStream codeStream)
}
}
public boolean resolvePatternVariable(BlockScope scope) {
- if (this.elementVariable == null) return false;
- if (this.elementVariable.binding == null) {
- this.elementVariable.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
- this.elementVariable.resolve(scope, true);
- // Kludge - to remove the AccBlankFinal added by the LocalDeclaration#resolve() due to the
- // missing initializer
- this.elementVariable.modifiers &= ~ExtraCompilerModifiers.AccBlankFinal;
- this.elementVariable.binding.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
- this.elementVariable.binding.useFlag = LocalVariableBinding.USED;
- // Why cant this be done in the constructor?
- this.type = this.elementVariable.type;
+ if (this.pattern != null) {
+ this.pattern.resolve(scope);
+ if (this.elementVariable == null) return false;
+ if (this.elementVariable.binding == null) {
+ this.elementVariable.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
+ this.elementVariable.resolve(scope, true);
+ // Kludge - to remove the AccBlankFinal added by the LocalDeclaration#resolve() due to the
+ // missing initializer
+ this.elementVariable.modifiers &= ~ExtraCompilerModifiers.AccBlankFinal;
+ this.elementVariable.binding.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
+ this.elementVariable.binding.useFlag = LocalVariableBinding.USED;
+ // Why cant this be done in the constructor?
+ this.type = this.elementVariable.type;
+ }
}
return true;
}
@Override
public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
this.expression.collectPatternVariablesToScope(variables, scope);
- if (this.elementVariable != null) {
- if (this.elementVariable.binding == null) {
- resolvePatternVariable(scope);
- if (variables != null) {
- for (LocalVariableBinding variable : variables) {
- if (CharOperation.equals(this.elementVariable.name, variable.name)) {
- scope.problemReporter().redefineLocal(this.elementVariable);
- }
- }
- }
- }
- if (this.patternVarsWhenTrue == null) {
- this.patternVarsWhenTrue = new LocalVariableBinding[1];
- this.patternVarsWhenTrue[0] = this.elementVariable.binding;
- } else {
- this.addPatternVariablesWhenTrue(new LocalVariableBinding[] {this.elementVariable.binding});
- }
+ if (this.pattern != null) {
+ this.pattern.collectPatternVariablesToScope(variables, scope);
+ this.addPatternVariablesWhenTrue(this.pattern.patternVarsWhenTrue);
}
-
}
@Override
public boolean containsPatternVariable() {
- return this.elementVariable != null;
+ return this.elementVariable != null || this.pattern != null;
}
@Override
-public LocalDeclaration getPatternVariableIntroduced() {
+public LocalDeclaration getPatternVariable() {
return this.elementVariable;
}
private void addSecretInstanceOfPatternExpressionValue(BlockScope scope1) {
@@ -368,7 +364,6 @@ private void addSecretInstanceOfPatternExpressionValue(BlockScope scope1) {
false);
local.setConstant(Constant.NotAConstant);
local.useFlag = LocalVariableBinding.USED;
- local.declaration = new LocalDeclaration(InstanceOfExpression.SECRET_INSTANCEOF_PATTERN_EXPRESSION_VALUE, 0, 0);
scope1.addLocalVariable(local);
this.secretInstanceOfPatternExpressionValue = local;
}
@@ -376,7 +371,7 @@ private void addSecretInstanceOfPatternExpressionValue(BlockScope scope1) {
@Override
public TypeBinding resolveType(BlockScope scope) {
this.constant = Constant.NotAConstant;
- if (this.elementVariable != null)
+ if (this.elementVariable != null || this.pattern != null)
addSecretInstanceOfPatternExpressionValue(scope);
resolvePatternVariable(scope);
TypeBinding checkedType = this.type.resolveType(scope, true /* check bounds*/);
@@ -384,6 +379,9 @@ public TypeBinding resolveType(BlockScope scope) {
((CastExpression) this.expression).setInstanceofType(checkedType); // for cast expression we need to know instanceof type to not tag unnecessary when needed
}
TypeBinding expressionType = this.expression.resolveType(scope);
+ if (this.pattern != null) {
+ this.pattern.resolveWithExpression(scope, this.expression);
+ }
if (expressionType != null && checkedType != null && this.type.hasNullTypeAnnotation(AnnotationPosition.ANY)) {
// don't complain if the entire operation is redundant anyway
if (!expressionType.isCompatibleWith(checkedType) || NullAnnotationMatching.analyse(checkedType, expressionType, -1).isAnyMismatch())
@@ -416,11 +414,6 @@ public TypeBinding resolveType(BlockScope scope) {
scope.problemReporter().notCompatibleTypesError(this, expressionType, checkedType);
}
}
- // finally, the subtype check
- if (this.secretInstanceOfPatternExpressionValue != null &&
- expressionType.isSubtypeOf(checkedType, false)) {
- scope.problemReporter().patternCannotBeSubtypeOfExpression(this.elementVariable.binding, this);
- }
return this.resolvedType = TypeBinding.BOOLEAN;
}
@Override
@@ -445,8 +438,8 @@ public void tagAsUnnecessaryCast(Scope scope, TypeBinding castType) {
public void traverse(ASTVisitor visitor, BlockScope scope) {
if (visitor.visit(this, scope)) {
this.expression.traverse(visitor, scope);
- if (this.elementVariable != null) {
- this.elementVariable.traverse(visitor, scope);
+ if (this.pattern != null) {
+ this.pattern.traverse(visitor, scope);
} else {
this.type.traverse(visitor, scope);
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Pattern.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Pattern.java
index abf299aba..337200c44 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Pattern.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Pattern.java
@@ -16,24 +16,67 @@ package org.eclipse.jdt.internal.compiler.ast;
import java.util.function.Supplier;
import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
+import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public abstract class Pattern extends Expression {
/* package */ boolean isTotalTypeNode = false;
+ static final char[] SECRET_PATTERN_VARIABLE_NAME = "secretPatternVariable".toCharArray(); //$NON-NLS-1$
+
+ public LocalVariableBinding secretPatternVariable = null;
+
+ protected MethodBinding accessorMethod;
+ /* package */ BranchLabel elseTarget;
+ /* package */ BranchLabel thenTarget;
+
public boolean isTotalForType(TypeBinding type) {
return false;
}
-
public TypeBinding resolveAtType(BlockScope scope, TypeBinding type) {
return null;
}
+ @Override
+ public TypeBinding resolveType(BlockScope scope) {
+ return resolveType(scope, true);
+ }
+ public TypeBinding resolveType(BlockScope scope, boolean isPatternVariable) {
+ return null;
+ }
+ public boolean isAlwaysTrue() {
+ return true;
+ }
+ @Override
+ public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ if (this.elseTarget == null)
+ this.elseTarget = new BranchLabel(codeStream);
+ if (this.thenTarget == null)
+ this.thenTarget = new BranchLabel(codeStream);
+ generateOptimizedBoolean(currentScope, codeStream, this.thenTarget, this.elseTarget);
+ }
+ public void suspendVariables(CodeStream codeStream, BlockScope scope) {
+ // nothing by default
+ }
+ public void resumeVariables(CodeStream codeStream, BlockScope scope) {
+ // nothing by default
+ }
+ public abstract void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel);
+ protected abstract void generatePatternVariable(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel);
+ protected abstract void wrapupGeneration(CodeStream codeStream);
+
+ public TypeReference getType() {
+ return null;
+ }
+ public abstract void resolveWithExpression(BlockScope scope, Expression expression);
public void setTargetSupplier(Supplier<BranchLabel> targetSupplier) {
// default implementation does nothing
}
+ protected abstract boolean isPatternTypeCompatible(TypeBinding other, BlockScope scope);
public abstract boolean dominates(Pattern p);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordPattern.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordPattern.java
new file mode 100644
index 000000000..f75f95cbc
--- /dev/null
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordPattern.java
@@ -0,0 +1,279 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.compiler.ast;
+
+import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
+import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
+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.lookup.BlockScope;
+import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
+import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
+import org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding;
+import org.eclipse.jdt.internal.compiler.lookup.Scope;
+import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
+
+public class RecordPattern extends TypePattern {
+
+ public Pattern[] patterns;
+ public TypeReference type;
+ int thenInitStateIndex1 = -1;
+ int thenInitStateIndex2 = -1;
+
+ public RecordPattern(LocalDeclaration local) {
+ super(local);
+ this.type = local.type;
+ this.sourceStart = local.sourceStart;
+ this.sourceEnd = local.sourceEnd;
+ }
+ public RecordPattern(TypeReference type, int sourceStart, int sourceEnd) {
+ super();
+ this.type = type;
+ this.sourceStart = sourceStart;
+ this.sourceEnd = sourceEnd;
+ }
+ @Override
+ public TypeReference getType() {
+ return this.type;
+ }
+ @Override
+ public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
+ if (this.resolvedType == null) {
+ this.resolveType(scope);
+ }
+ this.addPatternVariablesWhenTrue(variables);
+ super.collectPatternVariablesToScope(variables, scope);
+ for (Pattern p : this.patterns) {
+ p.collectPatternVariablesToScope(variables, scope);
+ this.addPatternVariablesWhenTrue(p.patternVarsWhenTrue);
+ }
+ }
+ @Override
+ public boolean checkUnsafeCast(Scope scope, TypeBinding castType, TypeBinding expressionType, TypeBinding match, boolean isNarrowing) {
+ if (!castType.isReifiable())
+ return CastExpression.checkUnsafeCast(this, scope, castType, expressionType, match, isNarrowing);
+ else
+ return super.checkUnsafeCast(scope, castType, expressionType, match, isNarrowing);
+ }
+
+ @Override
+ public LocalDeclaration getPatternVariable() {
+ return super.getPatternVariable();
+ }
+ @Override
+ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
+ this.thenInitStateIndex1 = currentScope.methodScope().recordInitializationStates(flowInfo);
+ flowInfo = super.analyseCode(currentScope, flowContext, flowInfo);
+ for (Pattern p : this.patterns) {
+ p.analyseCode(currentScope, flowContext, flowInfo);
+ }
+ flowInfo = flowInfo.safeInitsWhenTrue();
+ this.thenInitStateIndex2 = currentScope.methodScope().recordInitializationStates(flowInfo);
+ return flowInfo;
+ }
+ @Override
+ public boolean isTotalForType(TypeBinding t) {
+ return false;
+ }
+ @Override
+ public void resolveWithExpression(BlockScope scope, Expression exp) {
+ this.expression = exp;
+ }
+ @Override
+ public TypeBinding resolveAtType(BlockScope scope, TypeBinding u) {
+ for (Pattern p : this.patterns) {
+ p.resolveAtType(scope, u);
+ }
+ if (this.local != null) {
+ this.resolvedType = super.resolveAtType(scope, u);
+ }
+ return this.resolvedType;
+ }
+ @Override
+ public TypeBinding resolveType(BlockScope scope, boolean isPatternVariable) {
+ if (this.resolvedType != null)
+ return this.resolvedType;
+ super.resolveType(scope, isPatternVariable);
+
+ if (this.local != null) {
+ this.resolvedType = super.resolveType(scope);
+ } else {
+ this.resolvedType = this.type.resolveType(scope);
+ }
+ if (!this.resolvedType.isValidBinding())
+ return this.resolvedType;
+
+ initSecretPatternVariable(scope);
+
+ // check whether the give type reference is a record
+ // check whether a raw type is being used in pattern types
+ // check whether the pattern signature matches that of the record declaration
+ if (!this.resolvedType.isRecord()) {
+ scope.problemReporter().unexpectedTypeinRecordPattern(this.resolvedType, this.type);
+ return this.resolvedType;
+ } else if (this.resolvedType.isRawType()) {
+ scope.problemReporter().rawTypeInRecordPattern(this.resolvedType, this.type);
+ }
+ this.isTotalTypeNode = isTotalForType(this.resolvedType);
+ RecordComponentBinding[] components = this.resolvedType.components();
+ if (components.length != this.patterns.length) {
+ scope.problemReporter().recordPatternSignatureMismatch(this.resolvedType, this);
+ } else {
+ for (int i = 0; i < components.length; i++) {
+ Pattern p = this.patterns[i];
+ if (!(p instanceof TypePattern))
+ continue;
+ TypePattern tp = (TypePattern) p;
+ RecordComponentBinding componentBinding = components[i];
+ if (p.getType().isTypeNameVar(scope)) {
+ infuseInferredType(tp, componentBinding);
+ }
+ p.resolveType(scope, true);
+ TypeBinding expressionType = componentBinding.type;
+ if (p.isPatternTypeCompatible(expressionType, scope)) {
+ p.isTotalTypeNode = p.isTotalForType(componentBinding.type);
+ MethodBinding[] methods = this.resolvedType.getMethods(componentBinding.name);
+ if (methods != null && methods.length > 0) {
+ p.accessorMethod = methods[0];
+ }
+ }
+ }
+ }
+ return this.resolvedType;
+ }
+ private void infuseInferredType(TypePattern tp, RecordComponentBinding componentBinding) {
+ SingleTypeReference ref = new SingleTypeReference(tp.local.type.getTypeName()[0],
+ tp.local.type.sourceStart,
+ tp.local.type.sourceEnd) {
+ @Override
+ public TypeBinding resolveType(BlockScope scope, boolean checkBounds) {
+ return componentBinding.type;
+ }
+ };
+ tp.local.type = ref;
+ }
+ @Override
+ public boolean isAlwaysTrue() {
+ return false;
+ }
+ @Override
+ public boolean dominates(Pattern p) {
+ if (!this.resolvedType.isValidBinding())
+ return false;
+ if (!super.isTotalForType(p.resolvedType)) {
+ return false;
+ }
+ if (p instanceof RecordPattern) {
+ RecordPattern rp = (RecordPattern) p;
+ if (this.patterns.length != rp.patterns.length)
+ return false;
+ for(int i = 0; i < this.patterns.length; i++) {
+ if (!this.patterns[i].dominates(rp.patterns[i])) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+ @Override
+ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel) {
+ codeStream.checkcast(this.resolvedType);
+ initializePatternVariables(currentScope, codeStream);
+ generatePatternVariable(currentScope, codeStream, trueLabel, falseLabel);
+ wrapupGeneration(codeStream);
+ if (this.thenInitStateIndex2 != -1) {
+ codeStream.removeNotDefinitelyAssignedVariables(currentScope, this.thenInitStateIndex2);
+ codeStream.addDefinitelyAssignedVariables(currentScope, this.thenInitStateIndex2);
+ }
+ }
+ @Override
+ protected void generatePatternVariable(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel) {
+ if (!this.isTotalTypeNode) {
+ codeStream.load(this.secretPatternVariable);
+ codeStream.instance_of(this.resolvedType);
+ BranchLabel target = falseLabel != null ? falseLabel : new BranchLabel(codeStream);
+ codeStream.ifeq(target);
+ }
+ for (Pattern p : this.patterns) {
+ if (p.accessorMethod != null) {
+ codeStream.load(this.secretPatternVariable);
+ if (!this.isTotalTypeNode)
+ codeStream.checkcast(this.resolvedType);
+ generateArguments(p.accessorMethod, null, currentScope, codeStream);
+ codeStream.invoke(Opcodes.OPC_invokevirtual, p.accessorMethod, this.resolvedType, null);
+ if (!p.isTotalTypeNode) {
+ if (p instanceof TypePattern) {
+ ((TypePattern)p).initializePatternVariables(currentScope, codeStream);
+ codeStream.load(p.secretPatternVariable);
+ codeStream.instance_of(p.resolvedType);
+ BranchLabel target = falseLabel != null ? falseLabel : new BranchLabel(codeStream);
+ codeStream.ifeq(target);
+ codeStream.load(p.secretPatternVariable);
+ }
+ }
+ p.generateOptimizedBoolean(currentScope, codeStream, trueLabel, falseLabel);
+ }
+ }
+ super.generatePatternVariable(currentScope, codeStream, trueLabel, falseLabel);
+ }
+ @Override
+ public void wrapupGeneration(CodeStream codeStream) {
+ for (Pattern p : this.patterns) {
+ p.wrapupGeneration(codeStream);
+ }
+ super.wrapupGeneration(codeStream);
+ }
+ @Override
+ public void suspendVariables(CodeStream codeStream, BlockScope scope) {
+ codeStream.removeNotDefinitelyAssignedVariables(scope, this.thenInitStateIndex1);
+ }
+ @Override
+ public void resumeVariables(CodeStream codeStream, BlockScope scope) {
+ codeStream.addDefinitelyAssignedVariables(scope, this.thenInitStateIndex2);
+ }
+ @Override
+ public void traverse(ASTVisitor visitor, BlockScope scope) {
+ for (Pattern p : this.patterns) {
+ visitor.visit(p, scope);
+ }
+ if (visitor.visit(this, scope)) {
+ if (this.local != null)
+ this.local.traverse(visitor, scope);
+ else if (this.type != null) {
+ this.type.traverse(visitor, scope);
+ }
+ for (Pattern p : this.patterns) {
+ p.traverse(visitor, scope);
+ }
+ }
+ visitor.endVisit(this, scope);
+ }
+
+ @Override
+ public StringBuffer printExpression(int indent, StringBuffer output) {
+ output.append(this.type).append('(');
+ if (this.patterns != null) {
+ for (int i = 0; i < this.patterns.length; i++) {
+ if (i > 0) output.append(", "); //$NON-NLS-1$
+ this.patterns[i].print(0, output);
+ }
+ }
+ output.append(')');
+ if (this.local != null)
+ output.append(' ').append(this.local.name);
+ return output;
+ }
+}
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 ec3c66b5a..a50e4dfe4 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
@@ -35,12 +35,15 @@ public class SingleTypeReference extends TypeReference {
public char[] token;
+ public SingleTypeReference(char[] source, int start, int end) {
+ this.token = source;
+ this.sourceStart = start;
+ this.sourceEnd = end;
+}
public SingleTypeReference(char[] source, long pos) {
-
this.token = source;
- this.sourceStart = (int) (pos>>>32) ;
- this.sourceEnd = (int) (pos & 0x00000000FFFFFFFFL) ;
-
+ this.sourceStart = (int) (pos>>>32);
+ this.sourceEnd = (int) (pos & 0x00000000FFFFFFFFL);
}
@Override
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
index 72e68fdd0..bece4205f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java
@@ -73,7 +73,7 @@ public class SwitchStatement extends Expression {
public boolean containsPatterns;
public boolean containsNull;
- private BranchLabel switchPatternRestartTarget;
+ BranchLabel switchPatternRestartTarget;
/* package */ public Pattern totalPattern;
// fallthrough
@@ -700,17 +700,15 @@ public class SwitchStatement extends Expression {
&& caseStatement.patternIndex != -1 // for null
) {
Pattern pattern = (Pattern) caseStatement.constantExpressions[caseStatement.patternIndex];
- if (pattern instanceof GuardedPattern) {
- GuardedPattern guardedPattern = (GuardedPattern) pattern;
- if (!guardedPattern.isGuardTrueAlways()) {
- guardedPattern.suspendVariables(codeStream, this.scope);
- codeStream.loadInt(caseIndex);
- codeStream.store(this.restartIndexLocal, false);
- codeStream.goto_(this.switchPatternRestartTarget);
- guardedPattern.thenTarget.place();
- guardedPattern.resumeVariables(codeStream, this.scope);
- }
+ pattern.elseTarget.place();
+ pattern.suspendVariables(codeStream, this.scope);
+ if (!pattern.isAlwaysTrue()) {
+ codeStream.loadInt(caseIndex);
+ codeStream.store(this.restartIndexLocal, false);
+ codeStream.goto_(this.switchPatternRestartTarget);
}
+ pattern.thenTarget.place();
+ pattern.resumeVariables(codeStream, this.scope);
}
}
private void generateCodeSwitchPatternPrologue(BlockScope currentScope, CodeStream codeStream) {
@@ -724,8 +722,7 @@ public class SwitchStatement extends Expression {
codeStream.store(this.dispatchPatternCopy, false);
codeStream.addVariable(this.dispatchPatternCopy);
- int restartIndex = 0;
- codeStream.loadInt(restartIndex);
+ codeStream.loadInt(0); // restartIndex
codeStream.store(this.restartIndexLocal, false);
codeStream.addVariable(this.restartIndexLocal);
@@ -827,6 +824,21 @@ public class SwitchStatement extends Expression {
return false;
}
@Override
+ public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope skope) {
+ if (this.statements != null && this.containsPatterns) {
+ for (Statement stmt : this.statements) {
+ if (stmt instanceof CaseStatement) {
+ CaseStatement caseStatement = (CaseStatement) stmt;
+ if (caseStatement.constantExpressions != null) {
+ for (Expression exp : caseStatement.constantExpressions) {
+ exp.collectPatternVariablesToScope(variables, skope);
+ }
+ }
+ }
+ }
+ }
+ }
+ @Override
public void resolve(BlockScope upperScope) {
try {
boolean isEnumSwitch = false;
@@ -1180,7 +1192,6 @@ public class SwitchStatement extends Expression {
this.scope.addLocalVariable(this.dispatchPatternCopy);
this.dispatchPatternCopy.setConstant(Constant.NotAConstant);
this.dispatchPatternCopy.useFlag = LocalVariableBinding.USED;
-
this.restartIndexLocal = new LocalVariableBinding(SecretPatternRestartIndexName, TypeBinding.INT, ClassFileConstants.AccDefault, false);
this.scope.addLocalVariable(this.restartIndexLocal);
this.restartIndexLocal.setConstant(Constant.NotAConstant);
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 7121cdfa3..800bdaa2f 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
@@ -2035,7 +2035,7 @@ public void resolve() {
} // @Override on non-role types is detected by Annotation.resolveType
// SH}
- if ((this.bits & ASTNode.UndocumentedEmptyBlock) != 0) {
+ if ((this.bits & ASTNode.UndocumentedEmptyBlock) != 0 && this.nRecordComponents == 0) {
this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd);
}
boolean needSerialVersion =
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypePattern.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypePattern.java
index ca21799a9..7139e50f8 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypePattern.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypePattern.java
@@ -13,10 +13,14 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.ast;
+import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.ASTVisitor;
+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.codegen.BranchLabel;
import org.eclipse.jdt.internal.compiler.codegen.CodeStream;
import org.eclipse.jdt.internal.compiler.flow.FlowContext;
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
+import org.eclipse.jdt.internal.compiler.impl.Constant;
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding;
@@ -26,22 +30,39 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
public class TypePattern extends Pattern {
public LocalDeclaration local;
+ Expression expression;
public TypePattern(LocalDeclaration local) {
this.local = local;
}
-
+ protected TypePattern() {
+ }
+ @Override
+ public TypeReference getType() {
+ return this.local.type;
+ }
@Override
public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope) {
if (this.resolvedType == null) {
this.resolveType(scope);
}
if (this.local != null && this.local.binding != null) {
+ LocalVariableBinding binding = this.local.binding;
+ if (variables != null) {
+ for (LocalVariableBinding variable : variables) {
+ if (variable == binding) continue; // Shouldn't happen
+ if (CharOperation.equals(binding.name, variable.name)) {
+ scope.problemReporter().redefineLocal(this.local);
+ }
+ }
+ }
if (this.patternVarsWhenTrue == null) {
this.patternVarsWhenTrue = new LocalVariableBinding[1];
- this.patternVarsWhenTrue[0] = this.local.binding;
+ this.patternVarsWhenTrue[0] = binding;
} else {
- this.addPatternVariablesWhenTrue(new LocalVariableBinding[] {this.local.binding});
+ LocalVariableBinding[] vars = new LocalVariableBinding[1];
+ vars[0] = binding;
+ this.addPatternVariablesWhenTrue(vars);
}
}
}
@@ -55,26 +76,45 @@ public class TypePattern extends Pattern {
@Override
public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
- flowInfo.markAsDefinitelyAssigned(this.local.binding);
- if (!this.isTotalTypeNode) {
- // non-total type patterns create a nonnull local:
- flowInfo.markAsDefinitelyNonNull(this.local.binding);
- } else {
- // total type patterns inherit the nullness of the value being switched over, unless ...
- if (flowContext.associatedNode instanceof SwitchStatement) {
- SwitchStatement swStmt = (SwitchStatement) flowContext.associatedNode;
- int nullStatus = swStmt.containsNull
- ? FlowInfo.NON_NULL // ... null is handled in a separate case
- : swStmt.expression.nullStatus(flowInfo, flowContext);
- flowInfo.markNullStatus(this.local.binding, nullStatus);
+ if (this.local != null) {
+ flowInfo.markAsDefinitelyAssigned(this.local.binding);
+ if (!this.isTotalTypeNode) {
+ // non-total type patterns create a nonnull local:
+ flowInfo.markAsDefinitelyNonNull(this.local.binding);
+ } else {
+ // total type patterns inherit the nullness of the value being switched over, unless ...
+ if (flowContext.associatedNode instanceof SwitchStatement) {
+ SwitchStatement swStmt = (SwitchStatement) flowContext.associatedNode;
+ int nullStatus = swStmt.containsNull
+ ? FlowInfo.NON_NULL // ... null is handled in a separate case
+ : swStmt.expression.nullStatus(flowInfo, flowContext);
+ flowInfo.markNullStatus(this.local.binding, nullStatus);
+ }
}
}
+ super.analyseCode(currentScope, flowContext, flowInfo);
return flowInfo;
}
-
@Override
- public void generateCode(BlockScope currentScope, CodeStream codeStream) {
+ public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel) {
+ if (this.local != null) {
+ LocalVariableBinding localBinding = this.local.binding;
+ if (!this.isTotalTypeNode) {
+ codeStream.checkcast(localBinding.type);
+ }
+ this.local.generateCode(currentScope, codeStream);
+ codeStream.store(localBinding, false);
+ localBinding.recordInitializationStartPC(codeStream.position);
+ }
+ }
+ public void initializePatternVariables(BlockScope currentScope, CodeStream codeStream) {
+ codeStream.addVariable(this.secretPatternVariable);
+ codeStream.store(this.secretPatternVariable, false);
+ }
+ @Override
+ protected void generatePatternVariable(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel) {
if (this.local != null) {
+ codeStream.load(this.secretPatternVariable);
LocalVariableBinding localBinding = this.local.binding;
if (!this.isTotalTypeNode)
codeStream.checkcast(localBinding.type);
@@ -83,12 +123,18 @@ public class TypePattern extends Pattern {
localBinding.recordInitializationStartPC(codeStream.position);
}
}
-
@Override
- public LocalDeclaration getPatternVariableIntroduced() {
+ public void wrapupGeneration(CodeStream codeStream) {
+ codeStream.removeVariable(this.secretPatternVariable);
+ }
+ @Override
+ public LocalDeclaration getPatternVariable() {
return this.local;
}
-
+ @Override
+ public void resolveWithExpression(BlockScope scope, Expression exp) {
+ this.expression = exp;
+ }
@Override
public void resolve(BlockScope scope) {
this.resolveType(scope);
@@ -100,6 +146,20 @@ public class TypePattern extends Pattern {
return (type.isSubtypeOf(this.resolvedType, false));
}
@Override
+ protected boolean isPatternTypeCompatible(TypeBinding other, BlockScope scope) {
+ TypeBinding patternType = this.resolvedType;
+ if (patternType.isBaseType()) {
+ if (!TypeBinding.equalsEquals(other, patternType)) {
+ scope.problemReporter().incompatiblePatternType(this, other, patternType);
+ return false;
+ }
+ } else if (!checkCastTypesCompatibility(scope, other, patternType, this.expression, true)) {
+ scope.problemReporter().incompatiblePatternType(this, other, patternType);
+ return false;
+ }
+ return true;
+ }
+ @Override
public boolean dominates(Pattern p) {
return isTotalForType(p.resolvedType);
}
@@ -116,21 +176,35 @@ public class TypePattern extends Pattern {
}
return this.resolvedType;
}
-
@Override
- public TypeBinding resolveType(BlockScope scope) {
- if (this.resolvedType != null || this.local == null)
+ public TypeBinding resolveType(BlockScope scope, boolean isPatternVariable) {
+ if (this.resolvedType != null)
return this.resolvedType;
-
- this.local.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
- this.local.resolve(scope, true);
- if (this.local.binding != null) {
- this.local.binding.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
- this.local.binding.useFlag = LocalVariableBinding.USED;
- this.resolvedType = this.local.binding.type;
+ if (this.local != null) {
+ this.local.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
+ this.local.resolve(scope, isPatternVariable);
+ if (this.local.binding != null) {
+ this.local.binding.modifiers |= ExtraCompilerModifiers.AccPatternVariable;
+ this.local.binding.useFlag = LocalVariableBinding.USED;
+ this.resolvedType = this.local.binding.type;
+ }
+ initSecretPatternVariable(scope);
}
+
return this.resolvedType;
}
+ protected void initSecretPatternVariable(BlockScope scope) {
+ LocalVariableBinding l =
+ this.secretPatternVariable =
+ new LocalVariableBinding(
+ SECRET_PATTERN_VARIABLE_NAME,
+ this.resolvedType,
+ ClassFileConstants.AccDefault,
+ false);
+ l.setConstant(Constant.NotAConstant);
+ l.useFlag = LocalVariableBinding.USED;
+ scope.addLocalVariable(l);
+ }
@Override
public void traverse(ASTVisitor visitor, BlockScope scope) {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
index b74ad0ced..46fd40dba 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java
@@ -338,8 +338,8 @@ public class UnaryExpression extends OperatorExpression {
return this.expression.containsPatternVariable();
}
@Override
- public LocalDeclaration getPatternVariableIntroduced() {
- return this.expression.getPatternVariableIntroduced();
+ public LocalDeclaration getPatternVariable() {
+ return this.expression.getPatternVariable();
}
@Override
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 94cd8d3f1..6b7e815c0 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
@@ -141,9 +141,10 @@ public interface ClassFileConstants {
int MAJOR_VERSION_16 = 60;
int MAJOR_VERSION_17 = 61;
int MAJOR_VERSION_18 = 62;
+ int MAJOR_VERSION_19 = 63;
int MAJOR_VERSION_0 = 44;
- int MAJOR_LATEST_VERSION = MAJOR_VERSION_18;
+ int MAJOR_LATEST_VERSION = MAJOR_VERSION_19;
int MINOR_VERSION_0 = 0;
int MINOR_VERSION_1 = 1;
@@ -172,6 +173,7 @@ public interface ClassFileConstants {
long JDK16 = ((long)ClassFileConstants.MAJOR_VERSION_16 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK17 = ((long)ClassFileConstants.MAJOR_VERSION_17 << 16) + ClassFileConstants.MINOR_VERSION_0;
long JDK18 = ((long)ClassFileConstants.MAJOR_VERSION_18 << 16) + ClassFileConstants.MINOR_VERSION_0;
+ long JDK19 = ((long)ClassFileConstants.MAJOR_VERSION_19 << 16) + ClassFileConstants.MINOR_VERSION_0;
public static long getLatestJDKLevel() {
return ((long)ClassFileConstants.MAJOR_LATEST_VERSION << 16) + ClassFileConstants.MINOR_VERSION_0;
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 c2c278e56..7eff56d5c 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
@@ -300,6 +300,8 @@ public class CompilerOptions {
// Internally used option to allow debug framework compile evaluation snippets in context of modules, see bug 543604
public static final String OPTION_JdtDebugCompileMode = "org.eclipse.jdt.internal.debug.compile.mode"; //$NON-NLS-1$
+ public static final String OPTION_IgnoreUnnamedModuleForSplitPackage = "org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage"; //$NON-NLS-1$
+
/**
* Possible values for configurable options
*/
@@ -327,6 +329,7 @@ public class CompilerOptions {
public static final String VERSION_16 = "16"; //$NON-NLS-1$
public static final String VERSION_17 = "17"; //$NON-NLS-1$
public static final String VERSION_18 = "18"; //$NON-NLS-1$
+ public static final String VERSION_19 = "19"; //$NON-NLS-1$
/*
* Note: Whenever a new version is added, make sure getLatestVersion()
* is updated with it.
@@ -672,6 +675,9 @@ public class CompilerOptions {
/** Enable a less restrictive compile mode for JDT debug. */
public boolean enableJdtDebugCompileMode;
+ /** Should the compiler ignore the unnamed module when a package is defined in both a named module and the unnamed module? */
+ public boolean ignoreUnnamedModuleForSplitPackage;
+
// keep in sync with warningTokenToIrritant and warningTokenFromIrritant
public final static String[] warningTokens = {
"all", //$NON-NLS-1$
@@ -755,7 +761,7 @@ public class CompilerOptions {
* Return the latest Java language version supported by the Eclipse compiler
*/
public static String getLatestVersion() {
- return VERSION_18;
+ return VERSION_19;
}
/**
* Return the most specific option key controlling this irritant. Note that in some case, some irritant is controlled by
@@ -1746,6 +1752,7 @@ public class CompilerOptions {
optionsMap.put(OPTION_EnablePreviews, this.enablePreviewFeatures ? ENABLED : DISABLED);
optionsMap.put(OPTION_ReportPreviewFeatures, getSeverityString(PreviewFeatureUsed));
optionsMap.put(OPTION_ReportSuppressWarningNotFullyAnalysed, getSeverityString(SuppressWarningsNotAnalysed));
+ optionsMap.put(OPTION_IgnoreUnnamedModuleForSplitPackage, this.ignoreUnnamedModuleForSplitPackage ? ENABLED : DISABLED);
return optionsMap;
}
@@ -1947,6 +1954,7 @@ public class CompilerOptions {
this.enablePreviewFeatures = false;
this.enableJdtDebugCompileMode = false;
+ this.ignoreUnnamedModuleForSplitPackage = false;
}
public void set(Map<String, String> optionsMap) {
@@ -2535,6 +2543,14 @@ public class CompilerOptions {
this.enableJdtDebugCompileMode = false;
}
}
+
+ if ((optionValue = optionsMap.get(OPTION_IgnoreUnnamedModuleForSplitPackage)) != null) {
+ if (ENABLED.equals(optionValue)) {
+ this.ignoreUnnamedModuleForSplitPackage = true;
+ } else if (DISABLED.equals(optionValue)) {
+ this.ignoreUnnamedModuleForSplitPackage = false;
+ }
+ }
}
private String[] stringToNameList(String optionValue) {
@@ -2671,6 +2687,7 @@ public class CompilerOptions {
buf.append("\n\t- API leak: ").append(getSeverityString(APILeak)); //$NON-NLS-1$
buf.append("\n\t- unstable auto module name: ").append(getSeverityString(UnstableAutoModuleName)); //$NON-NLS-1$
buf.append("\n\t- SuppressWarnings not fully analysed: ").append(getSeverityString(SuppressWarningsNotAnalysed)); //$NON-NLS-1$
+ buf.append("\n\t- ignore package from unnamed module: ").append(this.ignoreUnnamedModuleForSplitPackage ? ENABLED : DISABLED); //$NON-NLS-1$
//{ObjectTeams
buf.append("\n\t- decapsulation : ").append(this.decapsulation); //$NON-NLS-1$
buf.append("\n\t- report if not exactly one basecall in callin method : ").append(getSeverityString(NotExactlyOneBasecall)); //$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
index 529d2408d..c54d1a5d7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
@@ -57,10 +57,14 @@ public enum JavaFeature {
Messages.bind(Messages.sealed_types),
new char[][] {TypeConstants.SEALED, TypeConstants.PERMITS},
false),
- PATTERN_MATCHING_IN_SWITCH(ClassFileConstants.JDK18,
+ PATTERN_MATCHING_IN_SWITCH(ClassFileConstants.JDK19,
Messages.bind(Messages.pattern_matching_switch),
new char[][] {},
true),
+ RECORD_PATTERNS(ClassFileConstants.JDK19,
+ Messages.bind(Messages.record_patterns),
+ new char[][] {},
+ true),
;
final long compliance;
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 125156a2b..55b24a595 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
@@ -567,6 +567,8 @@ public MethodBinding[] availableMethods() {
void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
if (!isPrototype()) throw new IllegalStateException();
+ ReferenceBinding previousRequester = this.environment.requestingType;
+ this.environment.requestingType = this;
try {
// default initialization for super-interfaces early, in case some aborting compilation error occurs,
// and still want to use binaries passed that point (e.g. type hierarchy resolver, see bug 63748).
@@ -913,6 +915,8 @@ void cachePartsFrom(IBinaryType binaryType, boolean needFieldsAndMethods) {
this.fields = Binding.NO_FIELDS;
if (this.methods == null)
this.methods = Binding.NO_METHODS;
+
+ this.environment.requestingType = previousRequester;
}
}
void markImplicitTerminalDeprecation(ReferenceBinding type) {
@@ -1658,7 +1662,7 @@ public RecordComponentBinding[] components() {
for (int i = this.components.length; --i >= 0;) {
resolveTypeFor(this.components[i]);
}
- this.tagBits |= ExtendedTagBits.AreRecordComponentsComplete;
+ this.extendedTagBits |= ExtendedTagBits.AreRecordComponentsComplete;
return this.components;
}
// NOTE: the type of each field of a binary type is resolved when needed
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
index 662aab1d6..9080d844c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java
@@ -700,6 +700,13 @@ private Binding internalGetBinding(char[][] compoundName, int mask, InvocationSi
CharOperation.subarray(compoundName, 0, currentIndex),
(ReferenceBinding) binding,
ProblemReasons.NotVisible);
+ if (packageBinding instanceof SplitPackageBinding) {
+ packageBinding = packageBinding.getVisibleFor(module(), false);
+ if (packageBinding instanceof SplitPackageBinding) {
+ problemReporter().conflictingPackagesFromModules((SplitPackageBinding) packageBinding, module(),
+ invocationSite.sourceStart(), invocationSite.sourceEnd());
+ }
+ }
break foundType;
}
packageBinding = (PackageBinding) binding;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
index 617342fb4..0b7dde818 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java
@@ -1028,7 +1028,7 @@ ImportBinding[] getDefaultImports() {
problemReporter().isClassPathCorrect(
TypeConstants.JAVA_LANG_OBJECT,
this.referenceContext,
- this.environment.missingClassFileLocation, false);
+ this.environment.missingClassFileLocation, false, null/*resolving j.l.O is not specific to any referencing type*/);
BinaryTypeBinding missingObject = this.environment.createMissingType(null, TypeConstants.JAVA_LANG_OBJECT);
importBinding = missingObject.fPackage;
}
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 8dd387890..a861dbc59 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
@@ -194,6 +194,9 @@ public class LookupEnvironment implements ProblemReasons, TypeConstants {
*/
public boolean suppressImportErrors; // per module
+ /** type that is driving current lookup attempts. */
+ public ReferenceBinding requestingType;
+
public String moduleVersion; // ROOT_ONLY
final static int BUILD_FIELDS_AND_METHODS = 4;
@@ -1948,7 +1951,7 @@ public ReferenceBinding getResolvedType(char[][] compoundName, ModuleBinding mod
this.problemReporter.isClassPathCorrect(
compoundName,
scope == null ? this.root.unitBeingCompleted : scope.referenceCompilationUnit(),
- this.missingClassFileLocation, implicitAnnotationUse);
+ this.missingClassFileLocation, implicitAnnotationUse, this.requestingType);
return createMissingType(null, compoundName);
}
public ReferenceBinding getResolvedJavaBaseType(char[][] compoundName, Scope scope) {
@@ -2116,7 +2119,7 @@ public ReferenceBinding getTypeFromCompoundName(char[][] compoundName, boolean i
binding = packageBinding.getType0(compoundName[compoundName.length - 1]);
}
if(binding == null) {
- binding = new UnresolvedReferenceBinding(compoundName, packageBinding);
+ binding = new UnresolvedReferenceBinding(compoundName, packageBinding, this.requestingType);
if (wasMissingType) {
binding.tagBits |= TagBits.HasMissingType; // record it was bound to a missing type
}
@@ -2130,7 +2133,7 @@ public ReferenceBinding getTypeFromCompoundName(char[][] compoundName, boolean i
* misconfiguration now that did not also exist in some equivalent form while producing the class files which encode
* these missing types. So no need to bark again. Note that wasMissingType == true signals a type referenced in a .class
* file which could not be found when the binary was produced. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=364450 */
- this.problemReporter.isClassPathCorrect(compoundName, this.root.unitBeingCompleted, this.missingClassFileLocation, false);
+ this.problemReporter.isClassPathCorrect(compoundName, this.root.unitBeingCompleted, this.missingClassFileLocation, false, this.requestingType);
}
// create a proxy for the missing BinaryType
binding = createMissingType(null, compoundName);
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 6e97d94df..6feeb3cac 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -620,10 +620,10 @@ public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin
this.parameters = Scope.substitute(this, originalMethod.parameters);
// error case where exception type variable would have been substituted by a non-reference type (207573)
if (inferredWithUncheckConversion) { // JSL 18.5.2: "If unchecked conversion was necessary..."
- this.returnType = getErasure18_5_2(originalMethod.returnType, environment, hasReturnProblem); // propagate simulation of Bug JDK_8026527
+ this.returnType = getErasure18_5_2(originalMethod.returnType, environment);
this.thrownExceptions = new ReferenceBinding[originalMethod.thrownExceptions.length];
for (int i = 0; i < originalMethod.thrownExceptions.length; i++) {
- this.thrownExceptions[i] = (ReferenceBinding) getErasure18_5_2(originalMethod.thrownExceptions[i], environment, false); // no excuse for exceptions
+ this.thrownExceptions[i] = (ReferenceBinding) getErasure18_5_2(originalMethod.thrownExceptions[i], environment);
}
} else {
this.returnType = Scope.substitute(this, originalMethod.returnType);
@@ -676,13 +676,12 @@ public class ParameterizedGenericMethodBinding extends ParameterizedMethodBindin
}
}
- TypeBinding getErasure18_5_2(TypeBinding type, LookupEnvironment env, boolean substitute) {
+ TypeBinding getErasure18_5_2(TypeBinding type, LookupEnvironment env) {
// opportunistic interpretation of (JLS 18.5.2):
// "If unchecked conversion was necessary ..., then ...
// the return type and thrown types of the invocation type of m are given by
// the erasure of the return type and thrown types of m's type."
- if (substitute)
- type = Scope.substitute(this, type);
+ type = Scope.substitute(this, type); // compliant with Bug JDK-8135087: Erasure for unchecked invocation happens after inference
return env.convertToRawType(type.erasure(), true);
}
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 52eff80f0..ab5c830af 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
@@ -138,7 +138,14 @@ public class ParameterizedTypeBinding extends ReferenceBinding implements Substi
public boolean isParameterizedType() {
return true;
}
-
+ @Override
+ public boolean isRecord() {
+ return this.type.isRecord();
+ }
+ @Override
+ public RecordComponentBinding[] components() {
+ return this.type.components();
+ }
//{ObjectTeams: make other inherited methods aware of type parameters:
@Override
public ReferenceBinding getRealClass() {
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 64ddd1e7a..3e64f1d5e 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
@@ -1262,10 +1262,6 @@ public FieldBinding[] fields() {
return Binding.NO_FIELDS;
}
-public RecordComponentBinding[] components() {
- return Binding.NO_COMPONENTS;
-}
-
public final int getAccessFlags() {
//{ObjectTeams: use extended mask (was AccJustFlag):
return this.modifiers & ExtraCompilerModifiers.AccOTTypeJustFlag;
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 f77863552..121d5c8e0 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
@@ -1567,13 +1567,11 @@ public abstract class Scope {
currentType.initializeForStaticImports();
FieldBinding field = currentType.getField(fieldName, needResolve);
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=316456
- boolean insideTypeAnnotations = this instanceof MethodScope && ((MethodScope) this).insideTypeAnnotation;
if (field != null) {
if (invisibleFieldsOk) {
return field;
}
- if (invocationSite == null || insideTypeAnnotations
+ if (invocationSite == null
? field.canBeSeenBy(getCurrentPackage())
: field.canBeSeenBy(currentType, invocationSite, this))
return field;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java
index 347f299dc..3d4fc7698 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java
@@ -268,23 +268,35 @@ public class SplitPackageBinding extends PackageBinding {
@Override
public PackageBinding getVisibleFor(ModuleBinding clientModule, boolean preferLocal) {
- int visibleCount = 0;
- PlainPackageBinding unique = null;
+ int visibleCountInNamedModules = 0;
+ PlainPackageBinding uniqueInNamedModules = null;
+ PlainPackageBinding bindingInUnnamedModule = null;
for (PlainPackageBinding incarnation : this.incarnations) {
if (incarnation.hasCompilationUnit(false)) {
if (preferLocal && incarnation.enclosingModule == clientModule) {
return incarnation;
} else {
if (clientModule.canAccess(incarnation)) {
- visibleCount++;
- unique = incarnation;
+ if (incarnation.enclosingModule.isUnnamed()) {
+ bindingInUnnamedModule = incarnation;
+ } else {
+ visibleCountInNamedModules++;
+ uniqueInNamedModules = incarnation;
+ }
}
}
}
}
- if (visibleCount > 1)
+ if (visibleCountInNamedModules > 1) {
return this; // conflict, return split
- return unique;
+ } else if (visibleCountInNamedModules == 1) {
+ if (this.environment.globalOptions.ignoreUnnamedModuleForSplitPackage || bindingInUnnamedModule == null) {
+ return uniqueInNamedModules;
+ } else {
+ return this;
+ }
+ }
+ return bindingInUnnamedModule;
}
@Override
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
index d23e835f1..dbb7980f2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java
@@ -1834,7 +1834,9 @@ public ReferenceBinding[] permittedTypes() {
public ReferenceBinding[] superInterfaces() {
return Binding.NO_SUPERINTERFACES;
}
-
+public RecordComponentBinding[] components() {
+ return Binding.NO_COMPONENTS;
+}
public SyntheticArgumentBinding[] syntheticOuterLocalVariables() {
return null; // is null if no enclosing instances are required
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
index bb1435a2a..0a76374e9 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java
@@ -33,14 +33,16 @@ public class UnresolvedReferenceBinding extends ReferenceBinding {
ReferenceBinding resolvedType;
TypeBinding[] wrappers;
UnresolvedReferenceBinding prototype;
+ReferenceBinding requestingType;
//{ObjectTeams: make visible to subclass:
protected
// SH}
-UnresolvedReferenceBinding(char[][] compoundName, PackageBinding packageBinding) {
+UnresolvedReferenceBinding(char[][] compoundName, PackageBinding packageBinding, ReferenceBinding requestingType) {
this.compoundName = compoundName;
this.sourceName = compoundName[compoundName.length - 1]; // reasonable guess
this.fPackage = packageBinding;
+ this.requestingType = requestingType;
this.wrappers = null;
this.prototype = this;
computeId();
@@ -136,7 +138,9 @@ public ReferenceBinding resolve(LookupEnvironment environment, boolean convertGe
environment.problemReporter.isClassPathCorrect(
this.compoundName,
environment.root.unitBeingCompleted,
- environment.missingClassFileLocation, false);
+ environment.missingClassFileLocation,
+ false,
+ this.requestingType);
}
// create a proxy for the missing BinaryType
targetType = environment.createMissingType(null, this.compoundName);
@@ -237,7 +241,7 @@ public TypeBinding deferredWrappableType(Scope scope, ReferenceBinding site, AST
} else {
this.deferredWrappableTypes = new HashMap<>();
}
- UnresolvedReferenceBinding deferred = new UnresolvedReferenceBinding(this.compoundName, getPackage()) {
+ UnresolvedReferenceBinding deferred = new UnresolvedReferenceBinding(this.compoundName, getPackage(), site) {
@Override
public ReferenceBinding resolve(LookupEnvironment environment, boolean convertGenericToRawType) {
ReferenceBinding type = UnresolvedReferenceBinding.this.resolve(environment, convertGenericToRawType);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
index 72e1c14ba..acf8b0f3a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties
@@ -73,3 +73,4 @@ pattern_matching_instanceof = Pattern Matching in instanceof Expressions
records = Records
sealed_types = Sealed Types
pattern_matching_switch = Pattern Matching in Switch
+record_patterns = Record Pattern
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
index e75911386..79703c505 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java
@@ -245,6 +245,8 @@ public interface JavadocTagConstants {
{},
// since 18
{},
+ // since 19
+ {},
};
public static final char[][][] INLINE_TAGS = {
// since 1.0
@@ -284,7 +286,9 @@ public interface JavadocTagConstants {
//since 17
{},
//since 18
- { TAG_SNIPPET }
+ { TAG_SNIPPET },
+ //since 19
+ {}
};
public static final char[][][] IN_SNIPPET_TAGS = {
//since 18
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 2218b08fe..9e92a37c9 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
@@ -279,6 +279,8 @@ public class Parser implements TerminalTokens, ParserBasicInformation, Conflicte
compliance = ClassFileConstants.JDK17;
} else if("18".equals(token)) { //$NON-NLS-1$
compliance = ClassFileConstants.JDK18;
+ } else if("19".equals(token)) { //$NON-NLS-1$
+ compliance = ClassFileConstants.JDK19;
} else if("recovery".equals(token)) { //$NON-NLS-1$
compliance = ClassFileConstants.JDK_DEFERRED;
}
@@ -5639,26 +5641,11 @@ protected void consumeInstanceOfExpression() {
}
}
protected Expression consumePatternInsideInstanceof(Pattern pattern) {
- Expression exp;
- if (pattern instanceof GuardedPattern) {
- // This is a workaround as InstanceOfExpression doesn't handle a guarded pattern
- // We alter the AST to look simpler
- // As a result of this, the following code
- // str instanceof (String a && a == null)
- // will be taken as
- // (str instanceof String a) && a == null
- GuardedPattern gPattern = (GuardedPattern) pattern;
- Expression insExpr = new InstanceOfExpression(
- this.expressionStack[this.expressionPtr],
- gPattern.primaryPattern);
- AND_AND_Expression andExpression = new AND_AND_Expression(insExpr, gPattern.condition, OperatorIds.AND_AND);
- this.expressionStack[this.expressionPtr] = exp = andExpression;
- } else {
- this.expressionStack[this.expressionPtr] = exp =
+ Expression exp =
+ this.expressionStack[this.expressionPtr] =
new InstanceOfExpression(
this.expressionStack[this.expressionPtr],
pattern);
- }
return exp;
}
protected void consumeTypeReferenceWithModifiersAndAnnotations() {
@@ -5698,15 +5685,15 @@ protected void consumeInstanceOfRHS() {
protected void consumeInstanceOfClassic() {
consumeTypeReferenceWithModifiersAndAnnotations();
}
-protected void consumeInstanceofPrimaryTypePattern() {
- consumeTypePattern();
- consumeInstanceofPattern();
-}
-protected void consumeInstanceofPrimaryParenPattern() {
- // TODO - check if parenthesis to be used for source position adjustment
- consumeInstanceofPattern();
+protected void consumeInstanceofPattern() {
+ this.astLengthPtr--;
+ Pattern pattern = (Pattern) this.astStack[this.astPtr--];
+ pushOnPatternStack(pattern);
+ // Only if we are not inside a block
+ if (this.realBlockPtr != -1)
+ blockReal();
}
-protected void consumePrimaryPattern() {
+protected void consumePattern() {
// TODO - check if parenthesis to be used for source position adjustment
}
protected void consumeParenthesizedPattern() {
@@ -5720,14 +5707,6 @@ protected void consumeParenthesizedPattern() {
pattern.bits &= ~ASTNode.ParenthesizedMASK;
pattern.bits |= (numberOfParenthesis + 1) << ASTNode.ParenthesizedSHIFT;
}
-protected void consumeInstanceofPattern() {
- this.astLengthPtr--;
- Pattern pattern = (Pattern) this.astStack[this.astPtr--];
- pushOnPatternStack(pattern);
- // Only if we are not inside a block
- if (this.realBlockPtr != -1)
- blockReal();
-}
protected void consumeInstanceOfExpressionWithName() {
// RelationalExpression_NotName ::= Name instanceof ReferenceType
//optimize the push/pop
@@ -8549,1010 +8528,1010 @@ protected void consumeZeroTypeAnnotations() {
// This method is part of an automatic generation : do NOT edit-modify
protected void consumeRule(int act) {
switch ( act ) {
- case 47 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$
+ case 48 : if (DEBUG) { System.out.println("Type ::= PrimitiveType"); } //$NON-NLS-1$
consumePrimitiveType();
break;
- case 61 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
+ case 62 : if (DEBUG) { System.out.println("ReferenceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
consumeReferenceType();
break;
- case 65 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$
+ case 66 : if (DEBUG) { System.out.println("ClassOrInterface ::= Name"); } //$NON-NLS-1$
consumeClassOrInterfaceName();
break;
- case 66 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$
+ case 67 : if (DEBUG) { System.out.println("ClassOrInterface ::= GenericType DOT Name"); } //$NON-NLS-1$
consumeClassOrInterface();
break;
- case 67 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$
+ case 68 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface TypeArguments"); } //$NON-NLS-1$
consumeGenericType();
break;
- case 68 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$
+ case 69 : if (DEBUG) { System.out.println("GenericType ::= ClassOrInterface LESS GREATER"); } //$NON-NLS-1$
consumeGenericTypeWithDiamond();
break;
- case 70 : if (DEBUG) { System.out.println("LiftingTypeopt ::= as BeginLiftingType Type"); } //$NON-NLS-1$
+ case 71 : if (DEBUG) { System.out.println("LiftingTypeopt ::= as BeginLiftingType Type"); } //$NON-NLS-1$
consumeLiftingType();
break;
- case 71 : if (DEBUG) { System.out.println("BeginLiftingType ::="); } //$NON-NLS-1$
+ case 72 : if (DEBUG) { System.out.println("BeginLiftingType ::="); } //$NON-NLS-1$
consumeBeginLiftingType();
break;
- case 73 : if (DEBUG) { System.out.println("CatchLiftingTypeopt ::= as Type"); } //$NON-NLS-1$
+ case 74 : if (DEBUG) { System.out.println("CatchLiftingTypeopt ::= as Type"); } //$NON-NLS-1$
consumeLiftingType();
break;
- case 74 : if (DEBUG) { System.out.println("BaseAnchoredType ::= base DOT SimpleName"); } //$NON-NLS-1$
+ case 75 : if (DEBUG) { System.out.println("BaseAnchoredType ::= base DOT SimpleName"); } //$NON-NLS-1$
consumeBaseAnchoredType();
break;
- case 77 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); } //$NON-NLS-1$
+ case 78 : if (DEBUG) { System.out.println("ArrayTypeWithTypeArgumentsName ::= GenericType DOT Name"); } //$NON-NLS-1$
consumeArrayTypeWithTypeArgumentsName();
break;
- case 78 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$
+ case 79 : if (DEBUG) { System.out.println("ArrayType ::= PrimitiveType Dims"); } //$NON-NLS-1$
consumePrimitiveArrayType();
break;
- case 79 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$
+ case 80 : if (DEBUG) { System.out.println("ArrayType ::= Name Dims"); } //$NON-NLS-1$
consumeNameArrayType();
break;
- case 80 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$
+ case 81 : if (DEBUG) { System.out.println("ArrayType ::= ArrayTypeWithTypeArgumentsName Dims"); } //$NON-NLS-1$
consumeGenericTypeNameArrayType();
break;
- case 81 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$
+ case 82 : if (DEBUG) { System.out.println("ArrayType ::= GenericType Dims"); } //$NON-NLS-1$
consumeGenericTypeArrayType();
break;
- case 83 : if (DEBUG) { System.out.println("Name ::= SimpleName"); } //$NON-NLS-1$
+ case 84 : if (DEBUG) { System.out.println("Name ::= SimpleName"); } //$NON-NLS-1$
consumeZeroTypeAnnotations();
break;
- case 88 : if (DEBUG) { System.out.println("UnannotatableName ::= UnannotatableName DOT SimpleName"); } //$NON-NLS-1$
+ case 89 : if (DEBUG) { System.out.println("UnannotatableName ::= UnannotatableName DOT SimpleName"); } //$NON-NLS-1$
consumeUnannotatableQualifiedName();
break;
- case 89 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$
+ case 90 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT SimpleName"); } //$NON-NLS-1$
consumeQualifiedName(false);
break;
- case 90 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT TypeAnnotations SimpleName"); } //$NON-NLS-1$
+ case 91 : if (DEBUG) { System.out.println("QualifiedName ::= Name DOT TypeAnnotations SimpleName"); } //$NON-NLS-1$
consumeQualifiedName(true);
break;
- case 91 : if (DEBUG) { System.out.println("TypeAnnotationsopt ::="); } //$NON-NLS-1$
+ case 92 : if (DEBUG) { System.out.println("TypeAnnotationsopt ::="); } //$NON-NLS-1$
consumeZeroTypeAnnotations();
break;
- case 92 : if (DEBUG) { System.out.println("TypeAnnotationsopt -> TypeAnnotations"); } //$NON-NLS-1$
+ case 93 : if (DEBUG) { System.out.println("TypeAnnotationsopt -> TypeAnnotations"); } //$NON-NLS-1$
confirmTypeAnnotation();
break;
- case 95 : if (DEBUG) { System.out.println("TypeAnnotations0 ::= TypeAnnotations0 TypeAnnotation"); } //$NON-NLS-1$
+ case 96 : if (DEBUG) { System.out.println("TypeAnnotations0 ::= TypeAnnotations0 TypeAnnotation"); } //$NON-NLS-1$
consumeOneMoreTypeAnnotation();
break;
- case 96 : if (DEBUG) { System.out.println("TypeAnnotation ::= NormalTypeAnnotation"); } //$NON-NLS-1$
+ case 97 : if (DEBUG) { System.out.println("TypeAnnotation ::= NormalTypeAnnotation"); } //$NON-NLS-1$
consumeTypeAnnotation();
break;
- case 97 : if (DEBUG) { System.out.println("TypeAnnotation ::= MarkerTypeAnnotation"); } //$NON-NLS-1$
+ case 98 : if (DEBUG) { System.out.println("TypeAnnotation ::= MarkerTypeAnnotation"); } //$NON-NLS-1$
consumeTypeAnnotation();
break;
- case 98 : if (DEBUG) { System.out.println("TypeAnnotation ::= SingleMemberTypeAnnotation"); } //$NON-NLS-1$
+ case 99 : if (DEBUG) { System.out.println("TypeAnnotation ::= SingleMemberTypeAnnotation"); } //$NON-NLS-1$
consumeTypeAnnotation();
break;
- case 99 : if (DEBUG) { System.out.println("TypeAnnotationName ::= AT308 UnannotatableName"); } //$NON-NLS-1$
+ case 100 : if (DEBUG) { System.out.println("TypeAnnotationName ::= AT308 UnannotatableName"); } //$NON-NLS-1$
consumeAnnotationName() ;
break;
- case 100 : if (DEBUG) { System.out.println("NormalTypeAnnotation ::= TypeAnnotationName LPAREN..."); } //$NON-NLS-1$
+ case 101 : if (DEBUG) { System.out.println("NormalTypeAnnotation ::= TypeAnnotationName LPAREN..."); } //$NON-NLS-1$
consumeNormalAnnotation(true) ;
break;
- case 101 : if (DEBUG) { System.out.println("MarkerTypeAnnotation ::= TypeAnnotationName"); } //$NON-NLS-1$
+ case 102 : if (DEBUG) { System.out.println("MarkerTypeAnnotation ::= TypeAnnotationName"); } //$NON-NLS-1$
consumeMarkerAnnotation(true) ;
break;
- case 102 : if (DEBUG) { System.out.println("SingleMemberTypeAnnotation ::= TypeAnnotationName LPAREN"); } //$NON-NLS-1$
+ case 103 : if (DEBUG) { System.out.println("SingleMemberTypeAnnotation ::= TypeAnnotationName LPAREN"); } //$NON-NLS-1$
consumeSingleMemberAnnotation(true) ;
break;
- case 103 : if (DEBUG) { System.out.println("RejectTypeAnnotations ::="); } //$NON-NLS-1$
+ case 104 : if (DEBUG) { System.out.println("RejectTypeAnnotations ::="); } //$NON-NLS-1$
consumeNonTypeUseName();
break;
- case 104 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$
+ case 105 : if (DEBUG) { System.out.println("PushZeroTypeAnnotations ::="); } //$NON-NLS-1$
consumeZeroTypeAnnotations();
break;
- case 105 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= this"); } //$NON-NLS-1$
+ case 106 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= this"); } //$NON-NLS-1$
consumeExplicitThisParameter(false);
break;
- case 106 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= UnannotatableName DOT..."); } //$NON-NLS-1$
+ case 107 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= UnannotatableName DOT..."); } //$NON-NLS-1$
consumeExplicitThisParameter(true);
break;
- case 107 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= VariableDeclaratorId"); } //$NON-NLS-1$
+ case 108 : if (DEBUG) { System.out.println("VariableDeclaratorIdOrThis ::= VariableDeclaratorId"); } //$NON-NLS-1$
consumeVariableDeclaratorIdParameter();
break;
- case 108 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$
+ case 109 : if (DEBUG) { System.out.println("CompilationUnit ::= EnterCompilationUnit..."); } //$NON-NLS-1$
consumeCompilationUnit();
break;
- case 109 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$
+ case 110 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration"); } //$NON-NLS-1$
consumeInternalCompilationUnit();
break;
- case 110 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ case 111 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
consumeInternalCompilationUnit();
break;
- case 111 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ case 112 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 112 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
+ case 113 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= PackageDeclaration..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 113 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 114 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeInternalCompilationUnit();
break;
- case 114 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$
+ case 115 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= TypeDeclarations"); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 115 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 116 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithTypes();
break;
- case 116 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$
+ case 117 : if (DEBUG) { System.out.println("InternalCompilationUnit ::="); } //$NON-NLS-1$
consumeEmptyInternalCompilationUnit();
break;
- case 117 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 118 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeInternalCompilationUnitWithModuleDeclaration();
break;
- case 118 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ModuleDeclaration"); } //$NON-NLS-1$
+ case 119 : if (DEBUG) { System.out.println("InternalCompilationUnit ::= ModuleDeclaration"); } //$NON-NLS-1$
consumeInternalCompilationUnitWithModuleDeclaration();
break;
- case 119 : if (DEBUG) { System.out.println("ModuleDeclaration ::= ModuleHeader ModuleBody"); } //$NON-NLS-1$
+ case 120 : if (DEBUG) { System.out.println("ModuleDeclaration ::= ModuleHeader ModuleBody"); } //$NON-NLS-1$
consumeModuleDeclaration();
break;
- case 120 : if (DEBUG) { System.out.println("ModuleHeader ::= Modifiersopt ModuleModifieropt module"); } //$NON-NLS-1$
+ case 121 : if (DEBUG) { System.out.println("ModuleHeader ::= Modifiersopt ModuleModifieropt module"); } //$NON-NLS-1$
consumeModuleHeader();
break;
- case 122 : if (DEBUG) { System.out.println("ModuleModifieropt ::= ModuleModifier"); } //$NON-NLS-1$
+ case 123 : if (DEBUG) { System.out.println("ModuleModifieropt ::= ModuleModifier"); } //$NON-NLS-1$
consumeModuleModifiers();
break;
- case 125 : if (DEBUG) { System.out.println("ModuleStatementsOpt ::="); } //$NON-NLS-1$
+ case 126 : if (DEBUG) { System.out.println("ModuleStatementsOpt ::="); } //$NON-NLS-1$
consumeEmptyModuleStatementsOpt();
break;
- case 128 : if (DEBUG) { System.out.println("ModuleStatements ::= ModuleStatements ModuleStatement"); } //$NON-NLS-1$
+ case 129 : if (DEBUG) { System.out.println("ModuleStatements ::= ModuleStatements ModuleStatement"); } //$NON-NLS-1$
consumeModuleStatements();
break;
- case 134 : if (DEBUG) { System.out.println("RequiresStatement ::= SingleRequiresModuleName SEMICOLON"); } //$NON-NLS-1$
+ case 135 : if (DEBUG) { System.out.println("RequiresStatement ::= SingleRequiresModuleName SEMICOLON"); } //$NON-NLS-1$
consumeRequiresStatement();
break;
- case 135 : if (DEBUG) { System.out.println("SingleRequiresModuleName ::= requires..."); } //$NON-NLS-1$
+ case 136 : if (DEBUG) { System.out.println("SingleRequiresModuleName ::= requires..."); } //$NON-NLS-1$
consumeSingleRequiresModuleName();
break;
- case 136 : if (DEBUG) { System.out.println("RequiresModifiersopt ::= RequiresModifiers"); } //$NON-NLS-1$
+ case 137 : if (DEBUG) { System.out.println("RequiresModifiersopt ::= RequiresModifiers"); } //$NON-NLS-1$
consumeModifiers();
break;
- case 137 : if (DEBUG) { System.out.println("RequiresModifiersopt ::="); } //$NON-NLS-1$
+ case 138 : if (DEBUG) { System.out.println("RequiresModifiersopt ::="); } //$NON-NLS-1$
consumeDefaultModifiers();
break;
- case 139 : if (DEBUG) { System.out.println("RequiresModifiers ::= RequiresModifiers RequiresModifier"); } //$NON-NLS-1$
+ case 140 : if (DEBUG) { System.out.println("RequiresModifiers ::= RequiresModifiers RequiresModifier"); } //$NON-NLS-1$
consumeModifiers2();
break;
- case 142 : if (DEBUG) { System.out.println("ExportsStatement ::= ExportsHeader TargetModuleListopt"); } //$NON-NLS-1$
+ case 143 : if (DEBUG) { System.out.println("ExportsStatement ::= ExportsHeader TargetModuleListopt"); } //$NON-NLS-1$
consumeExportsStatement();
break;
- case 143 : if (DEBUG) { System.out.println("ExportsHeader ::= exports SinglePkgName"); } //$NON-NLS-1$
+ case 144 : if (DEBUG) { System.out.println("ExportsHeader ::= exports SinglePkgName"); } //$NON-NLS-1$
consumeExportsHeader();
break;
- case 145 : if (DEBUG) { System.out.println("TargetModuleListopt ::= to TargetModuleNameList"); } //$NON-NLS-1$
+ case 146 : if (DEBUG) { System.out.println("TargetModuleListopt ::= to TargetModuleNameList"); } //$NON-NLS-1$
consumeTargetModuleList();
break;
- case 146 : if (DEBUG) { System.out.println("TargetModuleName ::= UnannotatableName"); } //$NON-NLS-1$
+ case 147 : if (DEBUG) { System.out.println("TargetModuleName ::= UnannotatableName"); } //$NON-NLS-1$
consumeSingleTargetModuleName();
break;
- case 148 : if (DEBUG) { System.out.println("TargetModuleNameList ::= TargetModuleNameList COMMA..."); } //$NON-NLS-1$
+ case 149 : if (DEBUG) { System.out.println("TargetModuleNameList ::= TargetModuleNameList COMMA..."); } //$NON-NLS-1$
consumeTargetModuleNameList();
break;
- case 149 : if (DEBUG) { System.out.println("SinglePkgName ::= UnannotatableName"); } //$NON-NLS-1$
+ case 150 : if (DEBUG) { System.out.println("SinglePkgName ::= UnannotatableName"); } //$NON-NLS-1$
consumeSinglePkgName();
break;
- case 150 : if (DEBUG) { System.out.println("OpensStatement ::= OpensHeader TargetModuleListopt..."); } //$NON-NLS-1$
+ case 151 : if (DEBUG) { System.out.println("OpensStatement ::= OpensHeader TargetModuleListopt..."); } //$NON-NLS-1$
consumeOpensStatement();
break;
- case 151 : if (DEBUG) { System.out.println("OpensHeader ::= opens SinglePkgName"); } //$NON-NLS-1$
+ case 152 : if (DEBUG) { System.out.println("OpensHeader ::= opens SinglePkgName"); } //$NON-NLS-1$
consumeOpensHeader();
break;
- case 152 : if (DEBUG) { System.out.println("UsesStatement ::= UsesHeader SEMICOLON"); } //$NON-NLS-1$
+ case 153 : if (DEBUG) { System.out.println("UsesStatement ::= UsesHeader SEMICOLON"); } //$NON-NLS-1$
consumeUsesStatement();
break;
- case 153 : if (DEBUG) { System.out.println("UsesHeader ::= uses Name"); } //$NON-NLS-1$
+ case 154 : if (DEBUG) { System.out.println("UsesHeader ::= uses Name"); } //$NON-NLS-1$
consumeUsesHeader();
break;
- case 154 : if (DEBUG) { System.out.println("ProvidesStatement ::= ProvidesInterface WithClause..."); } //$NON-NLS-1$
+ case 155 : if (DEBUG) { System.out.println("ProvidesStatement ::= ProvidesInterface WithClause..."); } //$NON-NLS-1$
consumeProvidesStatement();
break;
- case 155 : if (DEBUG) { System.out.println("ProvidesInterface ::= provides Name"); } //$NON-NLS-1$
+ case 156 : if (DEBUG) { System.out.println("ProvidesInterface ::= provides Name"); } //$NON-NLS-1$
consumeProvidesInterface();
break;
- case 156 : if (DEBUG) { System.out.println("ServiceImplName ::= Name"); } //$NON-NLS-1$
+ case 157 : if (DEBUG) { System.out.println("ServiceImplName ::= Name"); } //$NON-NLS-1$
consumeSingleServiceImplName();
break;
- case 158 : if (DEBUG) { System.out.println("ServiceImplNameList ::= ServiceImplNameList COMMA..."); } //$NON-NLS-1$
+ case 159 : if (DEBUG) { System.out.println("ServiceImplNameList ::= ServiceImplNameList COMMA..."); } //$NON-NLS-1$
consumeServiceImplNameList();
break;
- case 159 : if (DEBUG) { System.out.println("WithClause ::= with ServiceImplNameList"); } //$NON-NLS-1$
+ case 160 : if (DEBUG) { System.out.println("WithClause ::= with ServiceImplNameList"); } //$NON-NLS-1$
consumeWithClause();
break;
- case 160 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$
+ case 161 : if (DEBUG) { System.out.println("ReduceImports ::="); } //$NON-NLS-1$
consumeReduceImports();
break;
- case 161 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$
+ case 162 : if (DEBUG) { System.out.println("EnterCompilationUnit ::="); } //$NON-NLS-1$
consumeEnterCompilationUnit();
break;
- case 186 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
+ case 187 : if (DEBUG) { System.out.println("CatchHeader ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
consumeCatchHeader();
break;
- case 188 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$
+ case 189 : if (DEBUG) { System.out.println("ImportDeclarations ::= ImportDeclarations..."); } //$NON-NLS-1$
consumeImportDeclarations();
break;
- case 190 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$
+ case 191 : if (DEBUG) { System.out.println("TypeDeclarations ::= TypeDeclarations TypeDeclaration"); } //$NON-NLS-1$
consumeTypeDeclarations();
break;
- case 191 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$
+ case 192 : if (DEBUG) { System.out.println("PackageDeclaration ::= PackageDeclarationName SEMICOLON"); } //$NON-NLS-1$
consumePackageDeclaration();
break;
- case 192 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$
+ case 193 : if (DEBUG) { System.out.println("PackageDeclarationName ::= Modifiers package..."); } //$NON-NLS-1$
consumePackageDeclarationNameWithModifiers();
break;
- case 193 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$
+ case 194 : if (DEBUG) { System.out.println("PackageDeclarationName ::= PackageComment package Name"); } //$NON-NLS-1$
consumePackageDeclarationName();
break;
- case 194 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$
+ case 195 : if (DEBUG) { System.out.println("PackageComment ::="); } //$NON-NLS-1$
consumePackageComment();
break;
- case 200 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$
+ case 201 : if (DEBUG) { System.out.println("SingleTypeImportDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 201 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import ImportName..."); } //$NON-NLS-1$
+ case 202 : if (DEBUG) { System.out.println("SingleTypeImportDeclarationName ::= import ImportName..."); } //$NON-NLS-1$
consumeSingleTypeImportDeclarationName();
break;
- case 203 : if (DEBUG) { System.out.println("ImportName ::= Name DOT team DOT Name"); } //$NON-NLS-1$
+ case 204 : if (DEBUG) { System.out.println("ImportName ::= Name DOT team DOT Name"); } //$NON-NLS-1$
consumeNameContainingTeam();
break;
- case 204 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
+ case 205 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 205 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$
+ case 206 : if (DEBUG) { System.out.println("TypeImportOnDemandDeclarationName ::= import Name DOT..."); } //$NON-NLS-1$
consumeTypeImportOnDemandDeclarationName();
break;
- case 208 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ case 209 : if (DEBUG) { System.out.println("TypeDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyTypeDeclaration();
break;
- case 213 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$
+ case 214 : if (DEBUG) { System.out.println("Modifiers ::= Modifiers Modifier"); } //$NON-NLS-1$
consumeModifiers2();
break;
- case 227 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$
+ case 228 : if (DEBUG) { System.out.println("Modifier ::= Annotation"); } //$NON-NLS-1$
consumeAnnotationAsModifier();
break;
- case 230 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$
+ case 231 : if (DEBUG) { System.out.println("ClassDeclaration ::= ClassHeader ClassBody"); } //$NON-NLS-1$
consumeClassDeclaration();
break;
- case 231 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$
+ case 232 : if (DEBUG) { System.out.println("ClassHeader ::= ClassHeaderName ClassHeaderExtendsopt..."); } //$NON-NLS-1$
consumeClassHeader();
break;
- case 232 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$
+ case 233 : if (DEBUG) { System.out.println("ClassHeaderName ::= ClassHeaderName1 TypeParameters"); } //$NON-NLS-1$
consumeTypeHeaderNameWithTypeParameters();
break;
- case 234 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$
+ case 235 : if (DEBUG) { System.out.println("ClassHeaderName1 ::= Modifiersopt class Identifier"); } //$NON-NLS-1$
consumeClassHeaderName1();
break;
- case 235 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$
+ case 236 : if (DEBUG) { System.out.println("ClassHeaderExtends ::= extends ClassType"); } //$NON-NLS-1$
consumeClassHeaderExtends();
break;
- case 236 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$
+ case 237 : if (DEBUG) { System.out.println("ClassHeaderImplements ::= implements InterfaceTypeList"); } //$NON-NLS-1$
consumeClassHeaderImplements();
break;
- case 239 : if (DEBUG) { System.out.println("ClassHeaderPlayedBy ::= playedBy ClassType"); } //$NON-NLS-1$
+ case 240 : if (DEBUG) { System.out.println("ClassHeaderPlayedBy ::= playedBy ClassType"); } //$NON-NLS-1$
consumeClassHeaderPlayedBy();
break;
- case 245 : if (DEBUG) { System.out.println("PredicateHeader ::= when"); } //$NON-NLS-1$
+ case 246 : if (DEBUG) { System.out.println("PredicateHeader ::= when"); } //$NON-NLS-1$
consumePredicate(false);
break;
- case 247 : if (DEBUG) { System.out.println("BasePredicateHeader ::= base when"); } //$NON-NLS-1$
+ case 248 : if (DEBUG) { System.out.println("BasePredicateHeader ::= base when"); } //$NON-NLS-1$
consumePredicate(true);
break;
- case 248 : if (DEBUG) { System.out.println("PredicateBody ::= LPAREN ForceNoDiet Expression..."); } //$NON-NLS-1$
+ case 249 : if (DEBUG) { System.out.println("PredicateBody ::= LPAREN ForceNoDiet Expression..."); } //$NON-NLS-1$
consumePredicateExpression();
break;
- case 249 : if (DEBUG) { System.out.println("PredicateBody ::= LPAREN RPAREN"); } //$NON-NLS-1$
+ case 250 : if (DEBUG) { System.out.println("PredicateBody ::= LPAREN RPAREN"); } //$NON-NLS-1$
consumePredicateMissingExpression();
break;
- case 250 : if (DEBUG) { System.out.println("ForceBaseIsIdentifier ::="); } //$NON-NLS-1$
+ case 251 : if (DEBUG) { System.out.println("ForceBaseIsIdentifier ::="); } //$NON-NLS-1$
consumeForceBaseIsIdentifier();
break;
- case 251 : if (DEBUG) { System.out.println("RestoreBaseKeyword ::="); } //$NON-NLS-1$
+ case 252 : if (DEBUG) { System.out.println("RestoreBaseKeyword ::="); } //$NON-NLS-1$
consumeRestoreBaseKeyword();
break;
- case 253 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$
+ case 254 : if (DEBUG) { System.out.println("InterfaceTypeList ::= InterfaceTypeList COMMA..."); } //$NON-NLS-1$
consumeInterfaceTypeList();
break;
- case 254 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
+ case 255 : if (DEBUG) { System.out.println("InterfaceType ::= ClassOrInterfaceType"); } //$NON-NLS-1$
consumeInterfaceType();
break;
- case 257 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$
+ case 258 : if (DEBUG) { System.out.println("ClassBodyDeclarations ::= ClassBodyDeclarations..."); } //$NON-NLS-1$
consumeClassBodyDeclarations();
break;
- case 261 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$
+ case 262 : if (DEBUG) { System.out.println("ClassBodyDeclaration ::= Diet NestedMethod..."); } //$NON-NLS-1$
consumeClassBodyDeclaration();
break;
- case 262 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$
+ case 263 : if (DEBUG) { System.out.println("Diet ::="); } //$NON-NLS-1$
consumeDiet();
break;
- case 263 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$
+ case 264 : if (DEBUG) { System.out.println("Initializer ::= Diet NestedMethod CreateInitializer..."); } //$NON-NLS-1$
consumeClassBodyDeclaration();
break;
- case 264 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$
+ case 265 : if (DEBUG) { System.out.println("CreateInitializer ::="); } //$NON-NLS-1$
consumeCreateInitializer();
break;
- case 274 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ case 275 : if (DEBUG) { System.out.println("ClassMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyTypeDeclaration();
break;
- case 277 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 278 : if (DEBUG) { System.out.println("FieldDeclaration ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeFieldDeclaration();
break;
- case 279 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$
+ case 280 : if (DEBUG) { System.out.println("VariableDeclarators ::= VariableDeclarators COMMA..."); } //$NON-NLS-1$
consumeVariableDeclarators();
break;
- case 282 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$
+ case 283 : if (DEBUG) { System.out.println("EnterVariable ::="); } //$NON-NLS-1$
consumeEnterVariable();
break;
- case 283 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$
+ case 284 : if (DEBUG) { System.out.println("ExitVariableWithInitialization ::="); } //$NON-NLS-1$
consumeExitVariableWithInitialization();
break;
- case 284 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$
+ case 285 : if (DEBUG) { System.out.println("ExitVariableWithoutInitialization ::="); } //$NON-NLS-1$
consumeExitVariableWithoutInitialization();
break;
- case 285 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$
+ case 286 : if (DEBUG) { System.out.println("ForceNoDiet ::="); } //$NON-NLS-1$
consumeForceNoDiet();
break;
- case 286 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$
+ case 287 : if (DEBUG) { System.out.println("RestoreDiet ::="); } //$NON-NLS-1$
consumeRestoreDiet();
break;
- case 291 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
+ case 292 : if (DEBUG) { System.out.println("MethodDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
// set to true to consume a method with a body
consumeMethodDeclaration(true, false);
break;
- case 292 : if (DEBUG) { System.out.println("MethodDeclaration ::= DefaultMethodHeader MethodBody"); } //$NON-NLS-1$
+ case 293 : if (DEBUG) { System.out.println("MethodDeclaration ::= DefaultMethodHeader MethodBody"); } //$NON-NLS-1$
// set to true to consume a method with a body
consumeMethodDeclaration(true, true);
break;
- case 293 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$
+ case 294 : if (DEBUG) { System.out.println("AbstractMethodDeclaration ::= MethodHeader SEMICOLON"); } //$NON-NLS-1$
// set to false to consume a method without body
consumeMethodDeclaration(false, false);
break;
- case 294 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$
+ case 295 : if (DEBUG) { System.out.println("MethodHeader ::= MethodHeaderName FormalParameterListopt"); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 295 : if (DEBUG) { System.out.println("DefaultMethodHeader ::= DefaultMethodHeaderName..."); } //$NON-NLS-1$
+ case 296 : if (DEBUG) { System.out.println("DefaultMethodHeader ::= DefaultMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 296 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$
+ case 297 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt TypeParameters Type..."); } //$NON-NLS-1$
consumeMethodHeaderNameWithTypeParameters(false);
break;
- case 297 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$
+ case 298 : if (DEBUG) { System.out.println("MethodHeaderName ::= Modifiersopt Type Identifier LPAREN"); } //$NON-NLS-1$
consumeMethodHeaderName(false);
break;
- case 298 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
+ case 299 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
consumeMethodHeaderNameWithTypeParameters(false);
break;
- case 299 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault Type..."); } //$NON-NLS-1$
+ case 300 : if (DEBUG) { System.out.println("DefaultMethodHeaderName ::= ModifiersWithDefault Type..."); } //$NON-NLS-1$
consumeMethodHeaderName(false);
break;
- case 300 : if (DEBUG) { System.out.println("ModifiersWithDefault ::= Modifiersopt default..."); } //$NON-NLS-1$
+ case 301 : if (DEBUG) { System.out.println("ModifiersWithDefault ::= Modifiersopt default..."); } //$NON-NLS-1$
consumePushCombineModifiers();
break;
- case 301 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
+ case 302 : if (DEBUG) { System.out.println("MethodHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
consumeMethodHeaderRightParen();
break;
- case 302 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$
+ case 303 : if (DEBUG) { System.out.println("MethodHeaderExtendedDims ::= Dimsopt"); } //$NON-NLS-1$
consumeMethodHeaderExtendedDims();
break;
- case 303 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$
+ case 304 : if (DEBUG) { System.out.println("MethodHeaderThrowsClause ::= throws ClassTypeList"); } //$NON-NLS-1$
consumeMethodHeaderThrowsClause();
break;
- case 304 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$
+ case 305 : if (DEBUG) { System.out.println("ConstructorHeader ::= ConstructorHeaderName..."); } //$NON-NLS-1$
consumeConstructorHeader();
break;
- case 305 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$
+ case 306 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt TypeParameters..."); } //$NON-NLS-1$
consumeConstructorHeaderNameWithTypeParameters();
break;
- case 306 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$
+ case 307 : if (DEBUG) { System.out.println("ConstructorHeaderName ::= Modifiersopt Identifier LPAREN"); } //$NON-NLS-1$
consumeConstructorHeaderName();
break;
- case 308 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$
+ case 309 : if (DEBUG) { System.out.println("FormalParameterList ::= FormalParameterList COMMA..."); } //$NON-NLS-1$
consumeFormalParameterList();
break;
- case 309 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type LiftingTypeopt..."); } //$NON-NLS-1$
+ case 310 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type LiftingTypeopt..."); } //$NON-NLS-1$
consumeFormalParameter(false);
break;
- case 310 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type LiftingTypeopt..."); } //$NON-NLS-1$
+ case 311 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type LiftingTypeopt..."); } //$NON-NLS-1$
consumeFormalParameter(true);
break;
- case 311 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type LiftingTypeopt..."); } //$NON-NLS-1$
+ case 312 : if (DEBUG) { System.out.println("FormalParameter ::= Modifiersopt Type LiftingTypeopt..."); } //$NON-NLS-1$
consumeFormalParameter(true);
break;
- case 312 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$
+ case 313 : if (DEBUG) { System.out.println("CatchFormalParameter ::= Modifiersopt CatchType..."); } //$NON-NLS-1$
consumeCatchFormalParameter();
break;
- case 313 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$
+ case 314 : if (DEBUG) { System.out.println("CatchType ::= UnionType"); } //$NON-NLS-1$
consumeCatchType();
break;
- case 314 : if (DEBUG) { System.out.println("UnionType ::= Type"); } //$NON-NLS-1$
+ case 315 : if (DEBUG) { System.out.println("UnionType ::= Type"); } //$NON-NLS-1$
consumeUnionTypeAsClassType();
break;
- case 315 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$
+ case 316 : if (DEBUG) { System.out.println("UnionType ::= UnionType OR Type"); } //$NON-NLS-1$
consumeUnionType();
break;
- case 317 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$
+ case 318 : if (DEBUG) { System.out.println("ClassTypeList ::= ClassTypeList COMMA ClassTypeElt"); } //$NON-NLS-1$
consumeClassTypeList();
break;
- case 318 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$
+ case 319 : if (DEBUG) { System.out.println("ClassTypeElt ::= ClassType"); } //$NON-NLS-1$
consumeClassTypeElt();
break;
- case 319 : if (DEBUG) { System.out.println("MethodBody ::= Predicateopt NestedMethod LBRACE..."); } //$NON-NLS-1$
+ case 320 : if (DEBUG) { System.out.println("MethodBody ::= Predicateopt NestedMethod LBRACE..."); } //$NON-NLS-1$
consumeMethodBody();
break;
- case 320 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$
+ case 321 : if (DEBUG) { System.out.println("NestedMethod ::="); } //$NON-NLS-1$
consumeNestedMethod();
break;
- case 324 : if (DEBUG) { System.out.println("CalloutBinding ::= CalloutHeaderLong..."); } //$NON-NLS-1$
+ case 325 : if (DEBUG) { System.out.println("CalloutBinding ::= CalloutHeaderLong..."); } //$NON-NLS-1$
consumeCalloutBindingLong();
break;
- case 325 : if (DEBUG) { System.out.println("CalloutHeaderLong ::= CalloutBindingLeftLong..."); } //$NON-NLS-1$
+ case 326 : if (DEBUG) { System.out.println("CalloutHeaderLong ::= CalloutBindingLeftLong..."); } //$NON-NLS-1$
consumeCalloutHeader();
break;
- case 326 : if (DEBUG) { System.out.println("CalloutHeaderLong ::= CalloutBindingLeftLong..."); } //$NON-NLS-1$
+ case 327 : if (DEBUG) { System.out.println("CalloutHeaderLong ::= CalloutBindingLeftLong..."); } //$NON-NLS-1$
consumeCalloutHeader();
break;
- case 327 : if (DEBUG) { System.out.println("CalloutBindingLeftLong ::= MethodSpecLong CalloutKind"); } //$NON-NLS-1$
+ case 328 : if (DEBUG) { System.out.println("CalloutBindingLeftLong ::= MethodSpecLong CalloutKind"); } //$NON-NLS-1$
consumeCalloutBindingLeft(true);
break;
- case 328 : if (DEBUG) { System.out.println("CalloutBinding ::= Modifiersopt CalloutBindingLeftShort"); } //$NON-NLS-1$
+ case 329 : if (DEBUG) { System.out.println("CalloutBinding ::= Modifiersopt CalloutBindingLeftShort"); } //$NON-NLS-1$
consumeCalloutHeader();
break;
- case 329 : if (DEBUG) { System.out.println("CalloutBindingLeftShort ::= MethodSpecShort CalloutKind"); } //$NON-NLS-1$
+ case 330 : if (DEBUG) { System.out.println("CalloutBindingLeftShort ::= MethodSpecShort CalloutKind"); } //$NON-NLS-1$
consumeCalloutBindingLeft(false);
break;
- case 330 : if (DEBUG) { System.out.println("CalloutBinding ::= Modifiersopt CalloutBindingLeftShort"); } //$NON-NLS-1$
+ case 331 : if (DEBUG) { System.out.println("CalloutBinding ::= Modifiersopt CalloutBindingLeftShort"); } //$NON-NLS-1$
consumeCalloutParameterMappingsInvalid();
break;
- case 335 : if (DEBUG) { System.out.println("CalloutModifier ::= get"); } //$NON-NLS-1$
+ case 336 : if (DEBUG) { System.out.println("CalloutModifier ::= get"); } //$NON-NLS-1$
consumeCalloutModifier(TokenNameget);
break;
- case 336 : if (DEBUG) { System.out.println("CalloutModifier ::= set"); } //$NON-NLS-1$
+ case 337 : if (DEBUG) { System.out.println("CalloutModifier ::= set"); } //$NON-NLS-1$
consumeCalloutModifier(TokenNameset);
break;
- case 338 : if (DEBUG) { System.out.println("CalloutParameterMappingsopt ::= SEMICOLON"); } //$NON-NLS-1$
+ case 339 : if (DEBUG) { System.out.println("CalloutParameterMappingsopt ::= SEMICOLON"); } //$NON-NLS-1$
consumeParameterMappingsEmpty();
break;
- case 339 : if (DEBUG) { System.out.println("CalloutParameterMappings ::= with NestedParamMappings..."); } //$NON-NLS-1$
+ case 340 : if (DEBUG) { System.out.println("CalloutParameterMappings ::= with NestedParamMappings..."); } //$NON-NLS-1$
consumeParameterMappings();
break;
- case 342 : if (DEBUG) { System.out.println("CalloutParameterMappingList ::=..."); } //$NON-NLS-1$
+ case 343 : if (DEBUG) { System.out.println("CalloutParameterMappingList ::=..."); } //$NON-NLS-1$
consumeParameterMappingList();
break;
- case 343 : if (DEBUG) { System.out.println("CalloutParameterMappingList ::=..."); } //$NON-NLS-1$
+ case 344 : if (DEBUG) { System.out.println("CalloutParameterMappingList ::=..."); } //$NON-NLS-1$
consumeParameterMappingList();
break;
- case 344 : if (DEBUG) { System.out.println("ParameterMapping ::= Expression BINDOUT Identifier"); } //$NON-NLS-1$
+ case 345 : if (DEBUG) { System.out.println("ParameterMapping ::= Expression BINDOUT Identifier"); } //$NON-NLS-1$
consumeParameterMappingOut();
break;
- case 345 : if (DEBUG) { System.out.println("ParameterMapping ::= Identifier BINDIN..."); } //$NON-NLS-1$
+ case 346 : if (DEBUG) { System.out.println("ParameterMapping ::= Identifier BINDIN..."); } //$NON-NLS-1$
consumeParameterMappingIn();
break;
- case 346 : if (DEBUG) { System.out.println("NestedParamMappings ::="); } //$NON-NLS-1$
+ case 347 : if (DEBUG) { System.out.println("NestedParamMappings ::="); } //$NON-NLS-1$
consumeNestedParamMappings();
break;
- case 347 : if (DEBUG) { System.out.println("CallinBinding ::= CallinHeaderLong..."); } //$NON-NLS-1$
+ case 348 : if (DEBUG) { System.out.println("CallinBinding ::= CallinHeaderLong..."); } //$NON-NLS-1$
consumeCallinBindingLong();
break;
- case 348 : if (DEBUG) { System.out.println("CallinHeaderLong ::= CallinBindingLeftLong..."); } //$NON-NLS-1$
+ case 349 : if (DEBUG) { System.out.println("CallinHeaderLong ::= CallinBindingLeftLong..."); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 349 : if (DEBUG) { System.out.println("CallinHeaderLong ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
+ case 350 : if (DEBUG) { System.out.println("CallinHeaderLong ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 350 : if (DEBUG) { System.out.println("CallinBindingLeftLong ::= MethodSpecLong BINDIN"); } //$NON-NLS-1$
+ case 351 : if (DEBUG) { System.out.println("CallinBindingLeftLong ::= MethodSpecLong BINDIN"); } //$NON-NLS-1$
consumeCallinBindingLeft(true);
break;
- case 351 : if (DEBUG) { System.out.println("CallinBinding ::= Modifiersopt CallinBindingLeftShort..."); } //$NON-NLS-1$
+ case 352 : if (DEBUG) { System.out.println("CallinBinding ::= Modifiersopt CallinBindingLeftShort..."); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 352 : if (DEBUG) { System.out.println("CallinBinding ::= Modifiersopt CallinLabel Modifiersopt"); } //$NON-NLS-1$
+ case 353 : if (DEBUG) { System.out.println("CallinBinding ::= Modifiersopt CallinLabel Modifiersopt"); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 353 : if (DEBUG) { System.out.println("CallinBindingLeftShort ::= MethodSpecShort BINDIN"); } //$NON-NLS-1$
+ case 354 : if (DEBUG) { System.out.println("CallinBindingLeftShort ::= MethodSpecShort BINDIN"); } //$NON-NLS-1$
consumeCallinBindingLeft(false);
break;
- case 354 : if (DEBUG) { System.out.println("CallinLabel ::= SimpleName COLON"); } //$NON-NLS-1$
+ case 355 : if (DEBUG) { System.out.println("CallinLabel ::= SimpleName COLON"); } //$NON-NLS-1$
consumeCallinLabel();
break;
- case 355 : if (DEBUG) { System.out.println("CallinModifier ::= replace"); } //$NON-NLS-1$
+ case 356 : if (DEBUG) { System.out.println("CallinModifier ::= replace"); } //$NON-NLS-1$
consumeCallinModifier(TokenNamereplace);
break;
- case 356 : if (DEBUG) { System.out.println("CallinModifier ::= before"); } //$NON-NLS-1$
+ case 357 : if (DEBUG) { System.out.println("CallinModifier ::= before"); } //$NON-NLS-1$
consumeCallinModifier(TokenNamebefore);
break;
- case 357 : if (DEBUG) { System.out.println("CallinModifier ::= after"); } //$NON-NLS-1$
+ case 358 : if (DEBUG) { System.out.println("CallinModifier ::= after"); } //$NON-NLS-1$
consumeCallinModifier(TokenNameafter);
break;
- case 358 : if (DEBUG) { System.out.println("InvalidCallinModifier ::="); } //$NON-NLS-1$
+ case 359 : if (DEBUG) { System.out.println("InvalidCallinModifier ::="); } //$NON-NLS-1$
consumeCallinModifierMissing();
break;
- case 359 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 360 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt..."); } //$NON-NLS-1$
consumeCallinBindingInvalid(false,false);
break;
- case 360 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
+ case 361 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
consumeCallinBindingInvalid(false,false);
break;
- case 361 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 362 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt..."); } //$NON-NLS-1$
consumeCallinBindingInvalid(false,true);
break;
- case 362 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
+ case 363 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
consumeCallinBindingInvalid(false,true);
break;
- case 363 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= CallinBindingLeftLong..."); } //$NON-NLS-1$
+ case 364 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= CallinBindingLeftLong..."); } //$NON-NLS-1$
consumeCallinBindingInvalid(true,false);
break;
- case 364 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
+ case 365 : if (DEBUG) { System.out.println("InvalidCallinBinding ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
consumeCallinBindingInvalid(true,false);
break;
- case 366 : if (DEBUG) { System.out.println("CallinParameterMappingsopt ::= SEMICOLON"); } //$NON-NLS-1$
+ case 367 : if (DEBUG) { System.out.println("CallinParameterMappingsopt ::= SEMICOLON"); } //$NON-NLS-1$
consumeParameterMappingsEmpty();
break;
- case 367 : if (DEBUG) { System.out.println("CallinParameterMappings ::= with NestedParamMappings..."); } //$NON-NLS-1$
+ case 368 : if (DEBUG) { System.out.println("CallinParameterMappings ::= with NestedParamMappings..."); } //$NON-NLS-1$
consumeParameterMappings();
break;
- case 370 : if (DEBUG) { System.out.println("CallinParameterMappingList ::=..."); } //$NON-NLS-1$
+ case 371 : if (DEBUG) { System.out.println("CallinParameterMappingList ::=..."); } //$NON-NLS-1$
consumeParameterMappingList();
break;
- case 371 : if (DEBUG) { System.out.println("CallinParameterMappingList ::=..."); } //$NON-NLS-1$
+ case 372 : if (DEBUG) { System.out.println("CallinParameterMappingList ::=..."); } //$NON-NLS-1$
consumeParameterMappingList();
break;
- case 372 : if (DEBUG) { System.out.println("MethodSpecShort ::= SimpleName"); } //$NON-NLS-1$
+ case 373 : if (DEBUG) { System.out.println("MethodSpecShort ::= SimpleName"); } //$NON-NLS-1$
consumeMethodSpecShort();
break;
- case 373 : if (DEBUG) { System.out.println("MethodSpecLong ::= MethodHeaderName..."); } //$NON-NLS-1$
+ case 374 : if (DEBUG) { System.out.println("MethodSpecLong ::= MethodHeaderName..."); } //$NON-NLS-1$
consumeMethodSpecLong(false);
break;
- case 374 : if (DEBUG) { System.out.println("MethodSpecLong ::= ConstructorHeaderName..."); } //$NON-NLS-1$
+ case 375 : if (DEBUG) { System.out.println("MethodSpecLong ::= ConstructorHeaderName..."); } //$NON-NLS-1$
consumeMethodSpecLongCtor();
break;
- case 375 : if (DEBUG) { System.out.println("BaseMethodSpecLong ::= MethodHeaderName..."); } //$NON-NLS-1$
+ case 376 : if (DEBUG) { System.out.println("BaseMethodSpecLong ::= MethodHeaderName..."); } //$NON-NLS-1$
consumeMethodSpecLong(false);
break;
- case 376 : if (DEBUG) { System.out.println("BaseMethodSpecLong ::= MethodSpecNamePlus..."); } //$NON-NLS-1$
+ case 377 : if (DEBUG) { System.out.println("BaseMethodSpecLong ::= MethodSpecNamePlus..."); } //$NON-NLS-1$
consumeMethodSpecLong(true);
break;
- case 377 : if (DEBUG) { System.out.println("BaseMethodSpecLong ::= ConstructorHeaderName..."); } //$NON-NLS-1$
+ case 378 : if (DEBUG) { System.out.println("BaseMethodSpecLong ::= ConstructorHeaderName..."); } //$NON-NLS-1$
consumeMethodSpecLong(false);
break;
- case 378 : if (DEBUG) { System.out.println("MethodSpecNamePlus ::= Modifiersopt Type PLUS Identifier"); } //$NON-NLS-1$
+ case 379 : if (DEBUG) { System.out.println("MethodSpecNamePlus ::= Modifiersopt Type PLUS Identifier"); } //$NON-NLS-1$
consumeMethodHeaderName(false);
break;
- case 379 : if (DEBUG) { System.out.println("CalloutFieldSpecLong ::= CalloutModifier Type Identifier"); } //$NON-NLS-1$
+ case 380 : if (DEBUG) { System.out.println("CalloutFieldSpecLong ::= CalloutModifier Type Identifier"); } //$NON-NLS-1$
consumeFieldSpecLong();
break;
- case 382 : if (DEBUG) { System.out.println("BaseMethodSpecListShort ::= BaseMethodSpecListShort..."); } //$NON-NLS-1$
+ case 383 : if (DEBUG) { System.out.println("BaseMethodSpecListShort ::= BaseMethodSpecListShort..."); } //$NON-NLS-1$
consumeMethodSpecList();
break;
- case 386 : if (DEBUG) { System.out.println("MethodSpecListLong ::= MethodSpecListLong COMMA..."); } //$NON-NLS-1$
+ case 387 : if (DEBUG) { System.out.println("MethodSpecListLong ::= MethodSpecListLong COMMA..."); } //$NON-NLS-1$
consumeMethodSpecList();
break;
- case 387 : if (DEBUG) { System.out.println("PrecedenceDeclaration ::= precedence BindingNames..."); } //$NON-NLS-1$
+ case 388 : if (DEBUG) { System.out.println("PrecedenceDeclaration ::= precedence BindingNames..."); } //$NON-NLS-1$
consumePrecedenceDeclaration(false);
break;
- case 388 : if (DEBUG) { System.out.println("PrecedenceDeclaration ::= precedence after BindingNames"); } //$NON-NLS-1$
+ case 389 : if (DEBUG) { System.out.println("PrecedenceDeclaration ::= precedence after BindingNames"); } //$NON-NLS-1$
consumePrecedenceDeclaration(true);
break;
- case 390 : if (DEBUG) { System.out.println("BindingNames ::= BindingNames COMMA BindingName"); } //$NON-NLS-1$
+ case 391 : if (DEBUG) { System.out.println("BindingNames ::= BindingNames COMMA BindingName"); } //$NON-NLS-1$
consumeBindingNames();
break;
- case 391 : if (DEBUG) { System.out.println("BindingName ::= Name"); } //$NON-NLS-1$
+ case 392 : if (DEBUG) { System.out.println("BindingName ::= Name"); } //$NON-NLS-1$
consumeBindingName();
break;
- case 392 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$
+ case 393 : if (DEBUG) { System.out.println("StaticInitializer ::= StaticOnly Block"); } //$NON-NLS-1$
consumeStaticInitializer();
break;
- case 393 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$
+ case 394 : if (DEBUG) { System.out.println("StaticOnly ::= static"); } //$NON-NLS-1$
consumeStaticOnly();
break;
- case 394 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$
+ case 395 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader MethodBody"); } //$NON-NLS-1$
consumeConstructorDeclaration() ;
break;
- case 395 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$
+ case 396 : if (DEBUG) { System.out.println("ConstructorDeclaration ::= ConstructorHeader SEMICOLON"); } //$NON-NLS-1$
consumeInvalidConstructorDeclaration() ;
break;
- case 396 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$
+ case 397 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= this LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(0, THIS_CALL);
break;
- case 397 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$
+ case 398 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments this"); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(0,THIS_CALL);
break;
- case 398 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$
+ case 399 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= super LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(0,SUPER_CALL);
break;
- case 399 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 400 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= OnlyTypeArguments..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(0,SUPER_CALL);
break;
- case 400 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= tsuper LPAREN..."); } //$NON-NLS-1$
+ case 401 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= tsuper LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(0,TSUPER_CALL);
break;
- case 401 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT tsuper LPAREN"); } //$NON-NLS-1$
+ case 402 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT tsuper LPAREN"); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(2,TSUPER_CALL);
break;
- case 402 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$
+ case 403 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT super..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(1, SUPER_CALL);
break;
- case 403 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
+ case 404 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(1, SUPER_CALL);
break;
- case 404 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$
+ case 405 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT super LPAREN"); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(2, SUPER_CALL);
break;
- case 405 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
+ case 406 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(2, SUPER_CALL);
break;
- case 406 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$
+ case 407 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT this..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(1, THIS_CALL);
break;
- case 407 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
+ case 408 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Primary DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(1, THIS_CALL);
break;
- case 408 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$
+ case 409 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT this LPAREN"); } //$NON-NLS-1$
consumeExplicitConstructorInvocation(2, THIS_CALL);
break;
- case 409 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
+ case 410 : if (DEBUG) { System.out.println("ExplicitConstructorInvocation ::= Name DOT..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationWithTypeArguments(2, THIS_CALL);
break;
- case 410 : if (DEBUG) { System.out.println("BaseConstructorExpression ::= base LPAREN..."); } //$NON-NLS-1$
+ case 411 : if (DEBUG) { System.out.println("BaseConstructorExpression ::= base LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationBase(0);
break;
- case 411 : if (DEBUG) { System.out.println("BaseConstructorInvocation ::= base LPAREN..."); } //$NON-NLS-1$
+ case 412 : if (DEBUG) { System.out.println("BaseConstructorInvocation ::= base LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationBase(1);
break;
- case 412 : if (DEBUG) { System.out.println("BaseConstructorInvocation ::= Primary DOT base LPAREN..."); } //$NON-NLS-1$
+ case 413 : if (DEBUG) { System.out.println("BaseConstructorInvocation ::= Primary DOT base LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationBase(2);
break;
- case 413 : if (DEBUG) { System.out.println("BaseConstructorInvocation ::= Name DOT base LPAREN..."); } //$NON-NLS-1$
+ case 414 : if (DEBUG) { System.out.println("BaseConstructorInvocation ::= Name DOT base LPAREN..."); } //$NON-NLS-1$
consumeExplicitConstructorInvocationBase(3);
break;
- case 414 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$
+ case 415 : if (DEBUG) { System.out.println("InterfaceDeclaration ::= InterfaceHeader InterfaceBody"); } //$NON-NLS-1$
consumeInterfaceDeclaration();
break;
- case 415 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$
+ case 416 : if (DEBUG) { System.out.println("InterfaceHeader ::= InterfaceHeaderName..."); } //$NON-NLS-1$
consumeInterfaceHeader();
break;
- case 416 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$
+ case 417 : if (DEBUG) { System.out.println("InterfaceHeaderName ::= InterfaceHeaderName1..."); } //$NON-NLS-1$
consumeTypeHeaderNameWithTypeParameters();
break;
- case 418 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$
+ case 419 : if (DEBUG) { System.out.println("InterfaceHeaderName1 ::= Modifiersopt interface..."); } //$NON-NLS-1$
consumeInterfaceHeaderName1();
break;
- case 419 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$
+ case 420 : if (DEBUG) { System.out.println("InterfaceHeaderExtends ::= extends InterfaceTypeList"); } //$NON-NLS-1$
consumeInterfaceHeaderExtends();
break;
- case 422 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$
+ case 423 : if (DEBUG) { System.out.println("InterfaceMemberDeclarations ::=..."); } //$NON-NLS-1$
consumeInterfaceMemberDeclarations();
break;
- case 423 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
+ case 424 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyTypeDeclaration();
break;
- case 425 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
+ case 426 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
consumeInterfaceMethodDeclaration(false);
break;
- case 426 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
+ case 427 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= MethodHeader MethodBody"); } //$NON-NLS-1$
consumeInterfaceMethodDeclaration(false);
break;
- case 427 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
+ case 428 : if (DEBUG) { System.out.println("InterfaceMemberDeclaration ::= DefaultMethodHeader..."); } //$NON-NLS-1$
consumeInterfaceMethodDeclaration(true);
break;
- case 428 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
+ case 429 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
consumeInvalidConstructorDeclaration(true);
break;
- case 429 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
+ case 430 : if (DEBUG) { System.out.println("InvalidConstructorDeclaration ::= ConstructorHeader..."); } //$NON-NLS-1$
consumeInvalidConstructorDeclaration(false);
break;
- case 441 : if (DEBUG) { System.out.println("RecordDeclaration ::= RecordHeaderPart RecordBody"); } //$NON-NLS-1$
+ case 442 : if (DEBUG) { System.out.println("RecordDeclaration ::= RecordHeaderPart RecordBody"); } //$NON-NLS-1$
consumeRecordDeclaration();
break;
- case 442 : if (DEBUG) { System.out.println("RecordHeaderPart ::= RecordHeaderName RecordHeader..."); } //$NON-NLS-1$
+ case 443 : if (DEBUG) { System.out.println("RecordHeaderPart ::= RecordHeaderName RecordHeader..."); } //$NON-NLS-1$
consumeRecordHeaderPart();
break;
- case 443 : if (DEBUG) { System.out.println("RecordHeaderName ::= RecordHeaderName1 TypeParameters"); } //$NON-NLS-1$
+ case 444 : if (DEBUG) { System.out.println("RecordHeaderName ::= RecordHeaderName1 TypeParameters"); } //$NON-NLS-1$
consumeRecordHeaderNameWithTypeParameters();
break;
- case 445 : if (DEBUG) { System.out.println("RecordHeaderName1 ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 446 : if (DEBUG) { System.out.println("RecordHeaderName1 ::= Modifiersopt..."); } //$NON-NLS-1$
consumeRecordHeaderName1();
break;
- case 446 : if (DEBUG) { System.out.println("RecordComponentHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
+ case 447 : if (DEBUG) { System.out.println("RecordComponentHeaderRightParen ::= RPAREN"); } //$NON-NLS-1$
consumeRecordComponentHeaderRightParen();
break;
- case 447 : if (DEBUG) { System.out.println("RecordHeader ::= LPAREN RecordComponentsopt..."); } //$NON-NLS-1$
+ case 448 : if (DEBUG) { System.out.println("RecordHeader ::= LPAREN RecordComponentsopt..."); } //$NON-NLS-1$
consumeRecordHeader();
break;
- case 448 : if (DEBUG) { System.out.println("RecordComponentsopt ::="); } //$NON-NLS-1$
+ case 449 : if (DEBUG) { System.out.println("RecordComponentsopt ::="); } //$NON-NLS-1$
consumeRecordComponentsopt();
break;
- case 451 : if (DEBUG) { System.out.println("RecordComponents ::= RecordComponents COMMA..."); } //$NON-NLS-1$
+ case 452 : if (DEBUG) { System.out.println("RecordComponents ::= RecordComponents COMMA..."); } //$NON-NLS-1$
consumeRecordComponents();
break;
- case 453 : if (DEBUG) { System.out.println("RecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 454 : if (DEBUG) { System.out.println("RecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecordComponent(false);
break;
- case 454 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 455 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecordComponent(true);
break;
- case 455 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 456 : if (DEBUG) { System.out.println("VariableArityRecordComponent ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecordComponent(true);
break;
- case 456 : if (DEBUG) { System.out.println("RecordBody ::= LBRACE RecordBodyDeclarationopt RBRACE"); } //$NON-NLS-1$
+ case 457 : if (DEBUG) { System.out.println("RecordBody ::= LBRACE RecordBodyDeclarationopt RBRACE"); } //$NON-NLS-1$
consumeRecordBody();
break;
- case 457 : if (DEBUG) { System.out.println("RecordBodyDeclarationopt ::="); } //$NON-NLS-1$
+ case 458 : if (DEBUG) { System.out.println("RecordBodyDeclarationopt ::="); } //$NON-NLS-1$
consumeEmptyRecordBodyDeclaration();
break;
- case 460 : if (DEBUG) { System.out.println("RecordBodyDeclarations ::= RecordBodyDeclarations..."); } //$NON-NLS-1$
+ case 461 : if (DEBUG) { System.out.println("RecordBodyDeclarations ::= RecordBodyDeclarations..."); } //$NON-NLS-1$
consumeRecordBodyDeclarations();
break;
- case 461 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= ClassBodyDeclaration"); } //$NON-NLS-1$
+ case 462 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= ClassBodyDeclaration"); } //$NON-NLS-1$
consumeRecordBodyDeclaration();
break;
- case 462 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= CompactConstructorDeclaration"); } //$NON-NLS-1$
+ case 463 : if (DEBUG) { System.out.println("RecordBodyDeclaration ::= CompactConstructorDeclaration"); } //$NON-NLS-1$
consumeRecordBodyDeclaration();
break;
- case 463 : if (DEBUG) { System.out.println("CompactConstructorDeclaration ::=..."); } //$NON-NLS-1$
+ case 464 : if (DEBUG) { System.out.println("CompactConstructorDeclaration ::=..."); } //$NON-NLS-1$
consumeCompactConstructorDeclaration();
break;
- case 464 : if (DEBUG) { System.out.println("CompactConstructorHeader ::=..."); } //$NON-NLS-1$
+ case 465 : if (DEBUG) { System.out.println("CompactConstructorHeader ::=..."); } //$NON-NLS-1$
consumeCompactConstructorHeader();
break;
- case 465 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
+ case 466 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
consumeCompactConstructorHeaderName();
break;
- case 466 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 467 : if (DEBUG) { System.out.println("CompactConstructorHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
consumeCompactConstructorHeaderNameWithTypeParameters();
break;
- case 468 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression..."); } //$NON-NLS-1$
+ case 469 : if (DEBUG) { System.out.println("InstanceofExpression ::= InstanceofExpression..."); } //$NON-NLS-1$
consumeInstanceOfExpression();
break;
- case 471 : if (DEBUG) { System.out.println("InstanceofRHS -> InstanceofPrimaryParenPattern"); } //$NON-NLS-1$
+ case 471 : if (DEBUG) { System.out.println("InstanceofRHS -> InstanceofPattern"); } //$NON-NLS-1$
consumeInstanceOfRHS();
break;
@@ -9560,1719 +9539,1743 @@ protected void consumeRule(int act) {
consumeInstanceOfClassic();
break;
- case 473 : if (DEBUG) { System.out.println("InstanceofPrimaryTypePattern ::= instanceof Modifiersopt"); } //$NON-NLS-1$
- consumeInstanceofPrimaryTypePattern();
+ case 473 : if (DEBUG) { System.out.println("InstanceofPattern ::= instanceof Pattern"); } //$NON-NLS-1$
+ consumeInstanceofPattern();
break;
- case 474 : if (DEBUG) { System.out.println("InstanceofPrimaryParenPattern ::= instanceof..."); } //$NON-NLS-1$
- consumeInstanceofPrimaryParenPattern();
+ case 476 : if (DEBUG) { System.out.println("Pattern -> RecordPattern"); } //$NON-NLS-1$
+ consumePattern();
break;
- case 478 : if (DEBUG) { System.out.println("PrimaryPattern -> ParenthesizedPattern"); } //$NON-NLS-1$
- consumePrimaryPattern();
- break;
-
- case 479 : if (DEBUG) { System.out.println("ParenthesizedPattern ::= PushLPAREN Pattern PushRPAREN"); } //$NON-NLS-1$
+ case 477 : if (DEBUG) { System.out.println("ParenthesizedPattern ::= PushLPAREN Pattern PushRPAREN"); } //$NON-NLS-1$
consumeParenthesizedPattern();
break;
- case 480 : if (DEBUG) { System.out.println("TypePattern ::= Modifiersopt Type Identifier"); } //$NON-NLS-1$
+ case 478 : if (DEBUG) { System.out.println("TypePattern ::= Modifiersopt Type Identifier"); } //$NON-NLS-1$
consumeTypePattern();
break;
- case 481 : if (DEBUG) { System.out.println("GuardedPattern ::= PrimaryPattern AND_AND..."); } //$NON-NLS-1$
- consumeGuardedPattern();
+ case 479 : if (DEBUG) { System.out.println("RecordPattern ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ consumeRecordPattern();
+ break;
+
+ case 480 : if (DEBUG) { System.out.println("RecordPattern ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ consumeRecordPatternWithId();
+ break;
+
+ case 482 : if (DEBUG) { System.out.println("RecordStructurePattern ::= PushLPAREN..."); } //$NON-NLS-1$
+ consumeRecordStructure();
+ break;
+
+ case 483 : if (DEBUG) { System.out.println("RecordComponentPatternsopt ::="); } //$NON-NLS-1$
+ consumeRecordComponentPatternsopt();
break;
- case 483 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$
+ case 485 : if (DEBUG) { System.out.println("RecordComponentPatternList ::=..."); } //$NON-NLS-1$
+ consumeRecordComponentPatternList();
+ break;
+
+ case 487 : if (DEBUG) { System.out.println("PushLeftBrace ::="); } //$NON-NLS-1$
consumePushLeftBrace();
break;
- case 484 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$
+ case 488 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace ,opt RBRACE"); } //$NON-NLS-1$
consumeEmptyArrayInitializer();
break;
- case 485 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
+ case 489 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
consumeArrayInitializer();
break;
- case 486 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
+ case 490 : if (DEBUG) { System.out.println("ArrayInitializer ::= LBRACE PushLeftBrace..."); } //$NON-NLS-1$
consumeArrayInitializer();
break;
- case 488 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$
+ case 492 : if (DEBUG) { System.out.println("VariableInitializers ::= VariableInitializers COMMA..."); } //$NON-NLS-1$
consumeVariableInitializers();
break;
- case 489 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$
+ case 493 : if (DEBUG) { System.out.println("Block ::= OpenBlock LBRACE BlockStatementsopt RBRACE"); } //$NON-NLS-1$
consumeBlock();
break;
- case 490 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$
+ case 494 : if (DEBUG) { System.out.println("OpenBlock ::="); } //$NON-NLS-1$
consumeOpenBlock() ;
break;
- case 491 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatement"); } //$NON-NLS-1$
+ case 495 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatement"); } //$NON-NLS-1$
consumeBlockStatement() ;
break;
- case 492 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$
+ case 496 : if (DEBUG) { System.out.println("BlockStatements ::= BlockStatements BlockStatement"); } //$NON-NLS-1$
consumeBlockStatements() ;
break;
- case 500 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$
+ case 504 : if (DEBUG) { System.out.println("BlockStatement ::= InterfaceDeclaration"); } //$NON-NLS-1$
consumeInvalidInterfaceDeclaration();
break;
- case 501 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$
+ case 505 : if (DEBUG) { System.out.println("BlockStatement ::= AnnotationTypeDeclaration"); } //$NON-NLS-1$
consumeInvalidAnnotationTypeDeclaration();
break;
- case 502 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$
+ case 506 : if (DEBUG) { System.out.println("BlockStatement ::= EnumDeclaration"); } //$NON-NLS-1$
consumeInvalidEnumDeclaration();
break;
- case 503 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$
+ case 507 : if (DEBUG) { System.out.println("LocalVariableDeclarationStatement ::=..."); } //$NON-NLS-1$
consumeLocalVariableDeclarationStatement();
break;
- case 504 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$
+ case 508 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Type PushModifiers..."); } //$NON-NLS-1$
consumeLocalVariableDeclaration();
break;
- case 505 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$
+ case 509 : if (DEBUG) { System.out.println("LocalVariableDeclaration ::= Modifiers Type..."); } //$NON-NLS-1$
consumeLocalVariableDeclaration();
break;
- case 506 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$
+ case 510 : if (DEBUG) { System.out.println("PushModifiers ::="); } //$NON-NLS-1$
consumePushModifiers();
break;
- case 507 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$
+ case 511 : if (DEBUG) { System.out.println("PushModifiersForHeader ::="); } //$NON-NLS-1$
consumePushModifiersForHeader();
break;
- case 508 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$
+ case 512 : if (DEBUG) { System.out.println("PushRealModifiers ::="); } //$NON-NLS-1$
consumePushRealModifiers();
break;
- case 537 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$
+ case 541 : if (DEBUG) { System.out.println("EmptyStatement ::= SEMICOLON"); } //$NON-NLS-1$
consumeEmptyStatement();
break;
- case 538 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$
+ case 542 : if (DEBUG) { System.out.println("LabeledStatement ::= Label COLON Statement"); } //$NON-NLS-1$
consumeStatementLabel() ;
break;
- case 539 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$
+ case 543 : if (DEBUG) { System.out.println("LabeledStatementNoShortIf ::= Label COLON..."); } //$NON-NLS-1$
consumeStatementLabel() ;
break;
- case 540 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$
+ case 544 : if (DEBUG) { System.out.println("Label ::= Identifier"); } //$NON-NLS-1$
consumeLabel() ;
break;
- case 541 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$
+ case 545 : if (DEBUG) { System.out.println("ExpressionStatement ::= StatementExpression SEMICOLON"); } //$NON-NLS-1$
consumeExpressionStatement();
break;
- case 551 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 555 : if (DEBUG) { System.out.println("IfThenStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementIfNoElse();
break;
- case 552 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 556 : if (DEBUG) { System.out.println("IfThenElseStatement ::= if LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementIfWithElse();
break;
- case 553 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$
+ case 557 : if (DEBUG) { System.out.println("IfThenElseStatementNoShortIf ::= if LPAREN Expression..."); } //$NON-NLS-1$
consumeStatementIfWithElse();
break;
- case 554 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 558 : if (DEBUG) { System.out.println("SwitchStatement ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementSwitch() ;
break;
- case 555 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$
+ case 559 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE RBRACE"); } //$NON-NLS-1$
consumeEmptySwitchBlock() ;
break;
- case 558 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$
+ case 562 : if (DEBUG) { System.out.println("SwitchBlock ::= LBRACE SwitchBlockStatements..."); } //$NON-NLS-1$
consumeSwitchBlock() ;
break;
- case 560 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$
+ case 564 : if (DEBUG) { System.out.println("SwitchBlockStatements ::= SwitchBlockStatements..."); } //$NON-NLS-1$
consumeSwitchBlockStatements() ;
break;
- case 562 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$
+ case 566 : if (DEBUG) { System.out.println("SwitchBlockStatement ::= SwitchLabels BlockStatements"); } //$NON-NLS-1$
consumeSwitchBlockStatement() ;
break;
- case 564 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$
+ case 568 : if (DEBUG) { System.out.println("SwitchLabels ::= SwitchLabels SwitchLabel"); } //$NON-NLS-1$
consumeSwitchLabels() ;
break;
- case 565 : if (DEBUG) { System.out.println("SwitchLabel ::= SwitchLabelCaseLhs COLON"); } //$NON-NLS-1$
+ case 569 : if (DEBUG) { System.out.println("SwitchLabel ::= SwitchLabelCaseLhs COLON"); } //$NON-NLS-1$
consumeCaseLabel();
break;
- case 566 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$
+ case 570 : if (DEBUG) { System.out.println("SwitchLabel ::= default COLON"); } //$NON-NLS-1$
consumeDefaultLabel();
break;
- case 569 : if (DEBUG) { System.out.println("SwitchExpression ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 573 : if (DEBUG) { System.out.println("SwitchExpression ::= switch LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeSwitchExpression() ;
break;
- case 572 : if (DEBUG) { System.out.println("SwitchLabeledRule ::= SwitchLabeledThrowStatement"); } //$NON-NLS-1$
+ case 576 : if (DEBUG) { System.out.println("SwitchLabeledRule ::= SwitchLabeledThrowStatement"); } //$NON-NLS-1$
consumeSwitchLabeledRule();
break;
- case 573 : if (DEBUG) { System.out.println("SwitchLabeledExpression ::= SwitchLabelExpr Expression"); } //$NON-NLS-1$
+ case 577 : if (DEBUG) { System.out.println("SwitchLabeledExpression ::= SwitchLabelExpr Expression"); } //$NON-NLS-1$
consumeSwitchLabeledExpression();
break;
- case 574 : if (DEBUG) { System.out.println("SwitchLabeledBlock ::= SwitchLabelExpr Block"); } //$NON-NLS-1$
+ case 578 : if (DEBUG) { System.out.println("SwitchLabeledBlock ::= SwitchLabelExpr Block"); } //$NON-NLS-1$
consumeSwitchLabeledBlock();
break;
- case 575 : if (DEBUG) { System.out.println("SwitchLabeledThrowStatement ::= SwitchLabelExpr..."); } //$NON-NLS-1$
+ case 579 : if (DEBUG) { System.out.println("SwitchLabeledThrowStatement ::= SwitchLabelExpr..."); } //$NON-NLS-1$
consumeSwitchLabeledThrowStatement();
break;
- case 576 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= default ARROW"); } //$NON-NLS-1$
+ case 580 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= default ARROW"); } //$NON-NLS-1$
consumeDefaultLabelExpr();
break;
- case 577 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= SwitchLabelCaseLhs BeginCaseExpr..."); } //$NON-NLS-1$
+ case 581 : if (DEBUG) { System.out.println("SwitchLabelExpr ::= SwitchLabelCaseLhs BeginCaseExpr..."); } //$NON-NLS-1$
consumeCaseLabelExpr();
break;
- case 578 : if (DEBUG) { System.out.println("SwitchLabelCaseLhs ::= case CaseLabelElements"); } //$NON-NLS-1$
+ case 582 : if (DEBUG) { System.out.println("SwitchLabelCaseLhs ::= case CaseLabelElements"); } //$NON-NLS-1$
consumeSwitchLabelCaseLhs();
break;
- case 580 : if (DEBUG) { System.out.println("CaseLabelElements ::= CaseLabelElements COMMA..."); } //$NON-NLS-1$
+ case 584 : if (DEBUG) { System.out.println("CaseLabelElements ::= CaseLabelElements COMMA..."); } //$NON-NLS-1$
consumeCaseLabelElements();
break;
- case 581 : if (DEBUG) { System.out.println("CaseLabelElement ::= ConstantExpression"); } //$NON-NLS-1$
+ case 585 : if (DEBUG) { System.out.println("CaseLabelElement ::= ConstantExpression"); } //$NON-NLS-1$
consumeCaseLabelElement(CaseLabelKind.CASE_EXPRESSION);
break;
- case 582 : if (DEBUG) { System.out.println("CaseLabelElement ::= default"); } //$NON-NLS-1$
+ case 586 : if (DEBUG) { System.out.println("CaseLabelElement ::= default"); } //$NON-NLS-1$
consumeCaseLabelElement(CaseLabelKind.CASE_DEFAULT);
break;
- case 583 : if (DEBUG) { System.out.println("CaseLabelElement ::= BeginCaseElement Pattern"); } //$NON-NLS-1$
+ case 587 : if (DEBUG) { System.out.println("CaseLabelElement ::= CaseLabelElementPattern"); } //$NON-NLS-1$
+ consumeCaseLabelElement(CaseLabelKind.CASE_PATTERN);
+ break;
+
+ case 588 : if (DEBUG) { System.out.println("CaseLabelElement ::= CaseLabelElementPattern Guard"); } //$NON-NLS-1$
consumeCaseLabelElement(CaseLabelKind.CASE_PATTERN);
break;
- case 584 : if (DEBUG) { System.out.println("YieldStatement ::= RestrictedIdentifierYield Expression"); } //$NON-NLS-1$
+ case 589 : if (DEBUG) { System.out.println("CaseLabelElementPattern ::= BeginCaseElement Pattern"); } //$NON-NLS-1$
+ consumeCaseLabelElementPattern();
+ break;
+
+ case 590 : if (DEBUG) { System.out.println("Guard ::= RestrictedIdentifierWhen Expression"); } //$NON-NLS-1$
+ consumeGuard();
+ break;
+
+ case 591 : if (DEBUG) { System.out.println("YieldStatement ::= RestrictedIdentifierYield Expression"); } //$NON-NLS-1$
consumeStatementYield() ;
break;
- case 585 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 592 : if (DEBUG) { System.out.println("WhileStatement ::= while LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeStatementWhile() ;
break;
- case 586 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$
+ case 593 : if (DEBUG) { System.out.println("WhileStatementNoShortIf ::= while LPAREN Expression..."); } //$NON-NLS-1$
consumeStatementWhile() ;
break;
- case 587 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$
+ case 594 : if (DEBUG) { System.out.println("DoStatement ::= do Statement while LPAREN Expression..."); } //$NON-NLS-1$
consumeStatementDo() ;
break;
- case 588 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$
+ case 595 : if (DEBUG) { System.out.println("ForStatement ::= for LPAREN ForInitopt SEMICOLON..."); } //$NON-NLS-1$
consumeStatementFor() ;
break;
- case 589 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$
+ case 596 : if (DEBUG) { System.out.println("ForStatementNoShortIf ::= for LPAREN ForInitopt..."); } //$NON-NLS-1$
consumeStatementFor() ;
break;
- case 590 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$
+ case 597 : if (DEBUG) { System.out.println("ForInit ::= StatementExpressionList"); } //$NON-NLS-1$
consumeForInit() ;
break;
- case 594 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$
+ case 601 : if (DEBUG) { System.out.println("StatementExpressionList ::= StatementExpressionList..."); } //$NON-NLS-1$
consumeStatementExpressionList() ;
break;
- case 595 : if (DEBUG) { System.out.println("WithinStatement ::= within LPAREN Expression RPAREN..."); } //$NON-NLS-1$
+ case 602 : if (DEBUG) { System.out.println("WithinStatement ::= within LPAREN Expression RPAREN..."); } //$NON-NLS-1$
consumeWithinStatement();
break;
- case 596 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$
+ case 603 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression SEMICOLON"); } //$NON-NLS-1$
consumeSimpleAssertStatement() ;
break;
- case 597 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$
+ case 604 : if (DEBUG) { System.out.println("AssertStatement ::= assert Expression COLON Expression"); } //$NON-NLS-1$
consumeAssertStatement() ;
break;
- case 598 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$
+ case 605 : if (DEBUG) { System.out.println("BreakStatement ::= break SEMICOLON"); } //$NON-NLS-1$
consumeStatementBreak() ;
break;
- case 599 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$
+ case 606 : if (DEBUG) { System.out.println("BreakStatement ::= break Identifier SEMICOLON"); } //$NON-NLS-1$
consumeStatementBreakWithLabel() ;
break;
- case 600 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$
+ case 607 : if (DEBUG) { System.out.println("ContinueStatement ::= continue SEMICOLON"); } //$NON-NLS-1$
consumeStatementContinue() ;
break;
- case 601 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$
+ case 608 : if (DEBUG) { System.out.println("ContinueStatement ::= continue Identifier SEMICOLON"); } //$NON-NLS-1$
consumeStatementContinueWithLabel() ;
break;
- case 602 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$
+ case 609 : if (DEBUG) { System.out.println("ReturnStatement ::= return Expressionopt SEMICOLON"); } //$NON-NLS-1$
consumeStatementReturn() ;
break;
- case 603 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$
+ case 610 : if (DEBUG) { System.out.println("ThrowStatement ::= throw Expression SEMICOLON"); } //$NON-NLS-1$
consumeStatementThrow();
break;
- case 604 : if (DEBUG) { System.out.println("ThrowExpression ::= throw Expression"); } //$NON-NLS-1$
+ case 611 : if (DEBUG) { System.out.println("ThrowExpression ::= throw Expression"); } //$NON-NLS-1$
consumeThrowExpression() ;
break;
- case 605 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$
+ case 612 : if (DEBUG) { System.out.println("SynchronizedStatement ::= OnlySynchronized LPAREN..."); } //$NON-NLS-1$
consumeStatementSynchronized();
break;
- case 606 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$
+ case 613 : if (DEBUG) { System.out.println("OnlySynchronized ::= synchronized"); } //$NON-NLS-1$
consumeOnlySynchronized();
break;
- case 607 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$
+ case 614 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catches"); } //$NON-NLS-1$
consumeStatementTry(false, false);
break;
- case 608 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$
+ case 615 : if (DEBUG) { System.out.println("TryStatement ::= try TryBlock Catchesopt Finally"); } //$NON-NLS-1$
consumeStatementTry(true, false);
break;
- case 609 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
+ case 616 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
consumeStatementTry(false, true);
break;
- case 610 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
+ case 617 : if (DEBUG) { System.out.println("TryStatementWithResources ::= try ResourceSpecification"); } //$NON-NLS-1$
consumeStatementTry(true, true);
break;
- case 611 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$
+ case 618 : if (DEBUG) { System.out.println("ResourceSpecification ::= LPAREN Resources ;opt RPAREN"); } //$NON-NLS-1$
consumeResourceSpecification();
break;
- case 612 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$
+ case 619 : if (DEBUG) { System.out.println(";opt ::="); } //$NON-NLS-1$
consumeResourceOptionalTrailingSemiColon(false);
break;
- case 613 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$
+ case 620 : if (DEBUG) { System.out.println(";opt ::= SEMICOLON"); } //$NON-NLS-1$
consumeResourceOptionalTrailingSemiColon(true);
break;
- case 614 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$
+ case 621 : if (DEBUG) { System.out.println("Resources ::= Resource"); } //$NON-NLS-1$
consumeSingleResource();
break;
- case 615 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$
+ case 622 : if (DEBUG) { System.out.println("Resources ::= Resources TrailingSemiColon Resource"); } //$NON-NLS-1$
consumeMultipleResources();
break;
- case 616 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$
+ case 623 : if (DEBUG) { System.out.println("TrailingSemiColon ::= SEMICOLON"); } //$NON-NLS-1$
consumeResourceOptionalTrailingSemiColon(true);
break;
- case 617 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$
+ case 624 : if (DEBUG) { System.out.println("Resource ::= Type PushModifiers VariableDeclaratorId..."); } //$NON-NLS-1$
consumeResourceAsLocalVariableDeclaration();
break;
- case 618 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); } //$NON-NLS-1$
+ case 625 : if (DEBUG) { System.out.println("Resource ::= Modifiers Type PushRealModifiers..."); } //$NON-NLS-1$
consumeResourceAsLocalVariableDeclaration();
break;
- case 619 : if (DEBUG) { System.out.println("Resource ::= Name"); } //$NON-NLS-1$
+ case 626 : if (DEBUG) { System.out.println("Resource ::= Name"); } //$NON-NLS-1$
consumeResourceAsLocalVariable();
break;
- case 620 : if (DEBUG) { System.out.println("Resource ::= this"); } //$NON-NLS-1$
+ case 627 : if (DEBUG) { System.out.println("Resource ::= this"); } //$NON-NLS-1$
consumeResourceAsThis();
break;
- case 621 : if (DEBUG) { System.out.println("Resource ::= FieldAccess"); } //$NON-NLS-1$
+ case 628 : if (DEBUG) { System.out.println("Resource ::= FieldAccess"); } //$NON-NLS-1$
consumeResourceAsFieldAccess();
break;
- case 623 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$
+ case 630 : if (DEBUG) { System.out.println("ExitTryBlock ::="); } //$NON-NLS-1$
consumeExitTryBlock();
break;
- case 625 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$
+ case 632 : if (DEBUG) { System.out.println("Catches ::= Catches CatchClause"); } //$NON-NLS-1$
consumeCatches();
break;
- case 626 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
+ case 633 : if (DEBUG) { System.out.println("CatchClause ::= catch LPAREN CatchFormalParameter RPAREN"); } //$NON-NLS-1$
consumeStatementCatch() ;
break;
- case 628 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$
+ case 635 : if (DEBUG) { System.out.println("PushLPAREN ::= LPAREN"); } //$NON-NLS-1$
consumeLeftParen();
break;
- case 629 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$
+ case 636 : if (DEBUG) { System.out.println("PushRPAREN ::= RPAREN"); } //$NON-NLS-1$
consumeRightParen();
break;
- case 634 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$
+ case 641 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= this"); } //$NON-NLS-1$
consumePrimaryNoNewArrayThis();
break;
- case 635 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$
+ case 642 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Expression_NotName..."); } //$NON-NLS-1$
consumePrimaryNoNewArray();
break;
- case 636 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$
+ case 643 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PushLPAREN Name PushRPAREN"); } //$NON-NLS-1$
consumePrimaryNoNewArrayWithName();
break;
- case 640 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$
+ case 647 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT this"); } //$NON-NLS-1$
consumePrimaryNoNewArrayNameThis();
break;
- case 641 : if (DEBUG) { System.out.println("QualifiedSuperReceiver ::= Name DOT super"); } //$NON-NLS-1$
+ case 648 : if (DEBUG) { System.out.println("QualifiedSuperReceiver ::= Name DOT super"); } //$NON-NLS-1$
consumeQualifiedSuperReceiver();
break;
- case 642 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$
+ case 649 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayName();
break;
- case 643 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$
+ case 650 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= Name Dims DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayArrayType();
break;
- case 644 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$
+ case 651 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType Dims DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayPrimitiveArrayType();
break;
- case 645 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$
+ case 652 : if (DEBUG) { System.out.println("PrimaryNoNewArray ::= PrimitiveType DOT class"); } //$NON-NLS-1$
consumePrimaryNoNewArrayPrimitiveType();
break;
- case 646 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
+ case 653 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
consumeRoleClassLiteral();
break;
- case 652 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
+ case 659 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
consumeReferenceExpressionTypeArgumentsAndTrunk(false);
break;
- case 653 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
+ case 660 : if (DEBUG) { System.out.println("ReferenceExpressionTypeArgumentsAndTrunk0 ::=..."); } //$NON-NLS-1$
consumeReferenceExpressionTypeArgumentsAndTrunk(true);
break;
- case 654 : if (DEBUG) { System.out.println("ReferenceExpression ::= PrimitiveType Dims COLON_COLON"); } //$NON-NLS-1$
+ case 661 : if (DEBUG) { System.out.println("ReferenceExpression ::= PrimitiveType Dims COLON_COLON"); } //$NON-NLS-1$
consumeReferenceExpressionTypeForm(true);
break;
- case 655 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name Dimsopt COLON_COLON..."); } //$NON-NLS-1$
+ case 662 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name Dimsopt COLON_COLON..."); } //$NON-NLS-1$
consumeReferenceExpressionTypeForm(false);
break;
- case 656 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name BeginTypeArguments..."); } //$NON-NLS-1$
+ case 663 : if (DEBUG) { System.out.println("ReferenceExpression ::= Name BeginTypeArguments..."); } //$NON-NLS-1$
consumeReferenceExpressionGenericTypeForm();
break;
- case 657 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$
+ case 664 : if (DEBUG) { System.out.println("ReferenceExpression ::= Primary COLON_COLON..."); } //$NON-NLS-1$
consumeReferenceExpressionPrimaryForm();
break;
- case 658 : if (DEBUG) { System.out.println("ReferenceExpression ::= QualifiedSuperReceiver..."); } //$NON-NLS-1$
+ case 665 : if (DEBUG) { System.out.println("ReferenceExpression ::= QualifiedSuperReceiver..."); } //$NON-NLS-1$
consumeReferenceExpressionPrimaryForm();
break;
- case 659 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$
+ case 666 : if (DEBUG) { System.out.println("ReferenceExpression ::= super COLON_COLON..."); } //$NON-NLS-1$
consumeReferenceExpressionSuperForm();
break;
- case 660 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$
+ case 667 : if (DEBUG) { System.out.println("NonWildTypeArgumentsopt ::="); } //$NON-NLS-1$
consumeEmptyTypeArguments();
break;
- case 662 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$
+ case 669 : if (DEBUG) { System.out.println("IdentifierOrNew ::= Identifier"); } //$NON-NLS-1$
consumeIdentifierOrNew(false);
break;
- case 663 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$
+ case 670 : if (DEBUG) { System.out.println("IdentifierOrNew ::= new"); } //$NON-NLS-1$
consumeIdentifierOrNew(true);
break;
- case 664 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW EnterLambda"); } //$NON-NLS-1$
+ case 671 : if (DEBUG) { System.out.println("LambdaExpression ::= LambdaParameters ARROW EnterLambda"); } //$NON-NLS-1$
consumeLambdaExpression();
break;
- case 665 : if (DEBUG) { System.out.println("EnterLambda ::="); } //$NON-NLS-1$
+ case 672 : if (DEBUG) { System.out.println("EnterLambda ::="); } //$NON-NLS-1$
consumeLambdaHeader();
break;
- case 666 : if (DEBUG) { System.out.println("NestedLambda ::="); } //$NON-NLS-1$
+ case 673 : if (DEBUG) { System.out.println("NestedLambda ::="); } //$NON-NLS-1$
consumeNestedLambda();
break;
- case 667 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier NestedLambda"); } //$NON-NLS-1$
+ case 674 : if (DEBUG) { System.out.println("LambdaParameters ::= Identifier NestedLambda"); } //$NON-NLS-1$
consumeTypeElidedLambdaParameter(false);
break;
- case 673 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$
+ case 680 : if (DEBUG) { System.out.println("TypeElidedFormalParameterList ::=..."); } //$NON-NLS-1$
consumeFormalParameterList();
break;
- case 674 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$
+ case 681 : if (DEBUG) { System.out.println("TypeElidedFormalParameter ::= Modifiersopt Identifier"); } //$NON-NLS-1$
consumeTypeElidedLambdaParameter(true);
break;
- case 677 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$
+ case 684 : if (DEBUG) { System.out.println("ElidedLeftBraceAndReturn ::="); } //$NON-NLS-1$
consumeElidedLeftBraceAndReturn();
break;
- case 678 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$
+ case 685 : if (DEBUG) { System.out.println("AllocationHeader ::= new ClassType LPAREN..."); } //$NON-NLS-1$
consumeAllocationHeader();
break;
- case 679 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$
+ case 686 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionWithTypeArguments();
break;
- case 680 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$
+ case 687 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= new ClassType..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpression();
break;
- case 681 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
+ case 688 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;
break;
- case 682 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
+ case 689 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::= Primary DOT new..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualified() ;
break;
- case 683 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
+ case 690 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualified() ;
break;
- case 684 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
+ case 691 : if (DEBUG) { System.out.println("ClassInstanceCreationExpression ::=..."); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionQualifiedWithTypeArguments() ;
break;
- case 685 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$
+ case 692 : if (DEBUG) { System.out.println("EnterInstanceCreationArgumentList ::="); } //$NON-NLS-1$
consumeEnterInstanceCreationArgumentList();
break;
- case 686 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT new"); } //$NON-NLS-1$
+ case 693 : if (DEBUG) { System.out.println("ClassInstanceCreationExpressionName ::= Name DOT new"); } //$NON-NLS-1$
consumeClassInstanceCreationExpressionName() ;
break;
- case 687 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$
+ case 694 : if (DEBUG) { System.out.println("UnqualifiedClassBodyopt ::="); } //$NON-NLS-1$
consumeClassBodyopt();
break;
- case 689 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
+ case 696 : if (DEBUG) { System.out.println("UnqualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
consumeEnterAnonymousClassBody(false);
break;
- case 690 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$
+ case 697 : if (DEBUG) { System.out.println("QualifiedClassBodyopt ::="); } //$NON-NLS-1$
consumeClassBodyopt();
break;
- case 692 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
+ case 699 : if (DEBUG) { System.out.println("QualifiedEnterAnonymousClassBody ::="); } //$NON-NLS-1$
consumeEnterAnonymousClassBody(true);
break;
- case 694 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$
+ case 701 : if (DEBUG) { System.out.println("ArgumentList ::= ArgumentList COMMA Expression"); } //$NON-NLS-1$
consumeArgumentList();
break;
- case 695 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$
+ case 702 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new PrimitiveType..."); } //$NON-NLS-1$
consumeArrayCreationHeader();
break;
- case 696 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$
+ case 703 : if (DEBUG) { System.out.println("ArrayCreationHeader ::= new ClassOrInterfaceType..."); } //$NON-NLS-1$
consumeArrayCreationHeader();
break;
- case 697 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
+ case 704 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
consumeArrayCreationExpressionWithoutInitializer();
break;
- case 698 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$
+ case 705 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new PrimitiveType"); } //$NON-NLS-1$
consumeArrayCreationExpressionWithInitializer();
break;
- case 699 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
+ case 706 : if (DEBUG) { System.out.println("ArrayCreationWithoutArrayInitializer ::= new..."); } //$NON-NLS-1$
consumeArrayCreationExpressionWithoutInitializer();
break;
- case 700 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$
+ case 707 : if (DEBUG) { System.out.println("ArrayCreationWithArrayInitializer ::= new..."); } //$NON-NLS-1$
consumeArrayCreationExpressionWithInitializer();
break;
- case 702 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$
+ case 709 : if (DEBUG) { System.out.println("DimWithOrWithOutExprs ::= DimWithOrWithOutExprs..."); } //$NON-NLS-1$
consumeDimWithOrWithOutExprs();
break;
- case 704 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotationsopt LBRACKET..."); } //$NON-NLS-1$
+ case 711 : if (DEBUG) { System.out.println("DimWithOrWithOutExpr ::= TypeAnnotationsopt LBRACKET..."); } //$NON-NLS-1$
consumeDimWithOrWithOutExpr();
break;
- case 705 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$
+ case 712 : if (DEBUG) { System.out.println("Dims ::= DimsLoop"); } //$NON-NLS-1$
consumeDims();
break;
- case 708 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$
+ case 715 : if (DEBUG) { System.out.println("OneDimLoop ::= LBRACKET RBRACKET"); } //$NON-NLS-1$
consumeOneDimLoop(false);
break;
- case 709 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$
+ case 716 : if (DEBUG) { System.out.println("OneDimLoop ::= TypeAnnotations LBRACKET RBRACKET"); } //$NON-NLS-1$
consumeOneDimLoop(true);
break;
- case 710 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$
+ case 717 : if (DEBUG) { System.out.println("FieldAccess ::= Primary DOT Identifier"); } //$NON-NLS-1$
consumeFieldAccess(false);
break;
- case 711 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$
+ case 718 : if (DEBUG) { System.out.println("FieldAccess ::= super DOT Identifier"); } //$NON-NLS-1$
consumeFieldAccess(true);
break;
- case 712 : if (DEBUG) { System.out.println("FieldAccess ::= QualifiedSuperReceiver DOT Identifier"); } //$NON-NLS-1$
+ case 719 : if (DEBUG) { System.out.println("FieldAccess ::= QualifiedSuperReceiver DOT Identifier"); } //$NON-NLS-1$
consumeFieldAccess(false);
break;
- case 713 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
+ case 720 : if (DEBUG) { System.out.println("MethodInvocation ::= Name LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
consumeMethodInvocationName();
break;
- case 714 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 721 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationNameWithTypeArguments();
break;
- case 715 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 722 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationPrimaryWithTypeArguments();
break;
- case 716 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ case 723 : if (DEBUG) { System.out.println("MethodInvocation ::= Primary DOT Identifier LPAREN..."); } //$NON-NLS-1$
consumeMethodInvocationPrimary();
break;
- case 717 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
+ case 724 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
consumeMethodInvocationPrimary();
break;
- case 718 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
+ case 725 : if (DEBUG) { System.out.println("MethodInvocation ::= QualifiedSuperReceiver DOT..."); } //$NON-NLS-1$
consumeMethodInvocationPrimaryWithTypeArguments();
break;
- case 719 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 726 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationSuperWithTypeArguments();
break;
- case 720 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ case 727 : if (DEBUG) { System.out.println("MethodInvocation ::= super DOT Identifier LPAREN..."); } //$NON-NLS-1$
consumeMethodInvocationSuper();
break;
- case 721 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ case 728 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT Identifier LPAREN..."); } //$NON-NLS-1$
consumeMethodInvocationTSuper(UNQUALIFIED);
break;
- case 722 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 729 : if (DEBUG) { System.out.println("MethodInvocation ::= tsuper DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationTSuperWithTypeArguments(0);
break;
- case 723 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT Identifier..."); } //$NON-NLS-1$
+ case 730 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT Identifier..."); } //$NON-NLS-1$
consumeMethodInvocationTSuper(QUALIFIED);
break;
- case 724 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT..."); } //$NON-NLS-1$
+ case 731 : if (DEBUG) { System.out.println("MethodInvocation ::= Name DOT tsuper DOT..."); } //$NON-NLS-1$
consumeMethodInvocationTSuperWithTypeArguments(2);
break;
- case 725 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT Identifier LPAREN..."); } //$NON-NLS-1$
+ case 732 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT Identifier LPAREN..."); } //$NON-NLS-1$
consumeMethodInvocationBase(false);
break;
- case 726 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT OnlyTypeArguments..."); } //$NON-NLS-1$
+ case 733 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT OnlyTypeArguments..."); } //$NON-NLS-1$
consumeMethodInvocationBaseWithTypeArguments(false);
break;
- case 727 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT Identifier..."); } //$NON-NLS-1$
+ case 734 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT Identifier..."); } //$NON-NLS-1$
consumeMethodInvocationBase(true);
break;
- case 728 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT..."); } //$NON-NLS-1$
+ case 735 : if (DEBUG) { System.out.println("MethodInvocation ::= base DOT super DOT..."); } //$NON-NLS-1$
consumeMethodInvocationBaseWithTypeArguments(true);
break;
- case 729 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$
+ case 736 : if (DEBUG) { System.out.println("ArrayAccess ::= Name LBRACKET Expression RBRACKET"); } //$NON-NLS-1$
consumeArrayAccess(true);
break;
- case 730 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$
+ case 737 : if (DEBUG) { System.out.println("ArrayAccess ::= PrimaryNoNewArray LBRACKET Expression..."); } //$NON-NLS-1$
consumeArrayAccess(false);
break;
- case 731 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$
+ case 738 : if (DEBUG) { System.out.println("ArrayAccess ::= ArrayCreationWithArrayInitializer..."); } //$NON-NLS-1$
consumeArrayAccess(false);
break;
- case 733 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$
+ case 740 : if (DEBUG) { System.out.println("PostfixExpression ::= Name"); } //$NON-NLS-1$
consumePostfixExpression();
break;
- case 736 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$
+ case 743 : if (DEBUG) { System.out.println("PostIncrementExpression ::= PostfixExpression PLUS_PLUS"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS,true);
break;
- case 737 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$
+ case 744 : if (DEBUG) { System.out.println("PostDecrementExpression ::= PostfixExpression..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS,true);
break;
- case 738 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$
+ case 745 : if (DEBUG) { System.out.println("PushPosition ::="); } //$NON-NLS-1$
consumePushPosition();
break;
- case 741 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$
+ case 748 : if (DEBUG) { System.out.println("UnaryExpression ::= PLUS PushPosition UnaryExpression"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS);
break;
- case 742 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$
+ case 749 : if (DEBUG) { System.out.println("UnaryExpression ::= MINUS PushPosition UnaryExpression"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS);
break;
- case 744 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$
+ case 751 : if (DEBUG) { System.out.println("PreIncrementExpression ::= PLUS_PLUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS,false);
break;
- case 745 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$
+ case 752 : if (DEBUG) { System.out.println("PreDecrementExpression ::= MINUS_MINUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS,false);
break;
- case 747 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$
+ case 754 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= TWIDDLE PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.TWIDDLE);
break;
- case 748 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$
+ case 755 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus ::= NOT PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.NOT);
break;
- case 750 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$
+ case 757 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN PrimitiveType Dimsopt..."); } //$NON-NLS-1$
consumeCastExpressionWithPrimitiveType();
break;
- case 751 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
+ case 758 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
consumeCastExpressionWithGenericsArray();
break;
- case 752 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
+ case 759 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name..."); } //$NON-NLS-1$
consumeCastExpressionWithQualifiedGenericsArray();
break;
- case 753 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$
+ case 760 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name PushRPAREN..."); } //$NON-NLS-1$
consumeCastExpressionLL1();
break;
- case 754 : if (DEBUG) { System.out.println("CastExpression ::= BeginIntersectionCast PushLPAREN..."); } //$NON-NLS-1$
+ case 761 : if (DEBUG) { System.out.println("CastExpression ::= BeginIntersectionCast PushLPAREN..."); } //$NON-NLS-1$
consumeCastExpressionLL1WithBounds();
break;
- case 755 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$
+ case 762 : if (DEBUG) { System.out.println("CastExpression ::= PushLPAREN Name Dims..."); } //$NON-NLS-1$
consumeCastExpressionWithNameArray();
break;
- case 756 : if (DEBUG) { System.out.println("AdditionalBoundsListOpt ::="); } //$NON-NLS-1$
+ case 763 : if (DEBUG) { System.out.println("AdditionalBoundsListOpt ::="); } //$NON-NLS-1$
consumeZeroAdditionalBounds();
break;
- case 760 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$
+ case 767 : if (DEBUG) { System.out.println("OnlyTypeArgumentsForCastExpression ::= OnlyTypeArguments"); } //$NON-NLS-1$
consumeOnlyTypeArgumentsForCastExpression();
break;
- case 761 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$
+ case 768 : if (DEBUG) { System.out.println("InsideCastExpression ::="); } //$NON-NLS-1$
consumeInsideCastExpression();
break;
- case 762 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$
+ case 769 : if (DEBUG) { System.out.println("InsideCastExpressionLL1 ::="); } //$NON-NLS-1$
consumeInsideCastExpressionLL1();
break;
- case 763 : if (DEBUG) { System.out.println("InsideCastExpressionLL1WithBounds ::="); } //$NON-NLS-1$
+ case 770 : if (DEBUG) { System.out.println("InsideCastExpressionLL1WithBounds ::="); } //$NON-NLS-1$
consumeInsideCastExpressionLL1WithBounds ();
break;
- case 764 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$
+ case 771 : if (DEBUG) { System.out.println("InsideCastExpressionWithQualifiedGenerics ::="); } //$NON-NLS-1$
consumeInsideCastExpressionWithQualifiedGenerics();
break;
- case 766 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ case 773 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MULTIPLY);
break;
- case 767 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ case 774 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.DIVIDE);
break;
- case 768 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
+ case 775 : if (DEBUG) { System.out.println("MultiplicativeExpression ::= MultiplicativeExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.REMAINDER);
break;
- case 770 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$
+ case 777 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression PLUS..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.PLUS);
break;
- case 771 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$
+ case 778 : if (DEBUG) { System.out.println("AdditiveExpression ::= AdditiveExpression MINUS..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MINUS);
break;
- case 773 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$
+ case 780 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression LEFT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
break;
- case 774 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$
+ case 781 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression RIGHT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
break;
- case 775 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 782 : if (DEBUG) { System.out.println("ShiftExpression ::= ShiftExpression UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
break;
- case 777 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
+ case 784 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS);
break;
- case 778 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$
+ case 785 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression GREATER..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER);
break;
- case 779 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$
+ case 786 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression LESS_EQUAL"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS_EQUAL);
break;
- case 780 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$
+ case 787 : if (DEBUG) { System.out.println("RelationalExpression ::= RelationalExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
break;
- case 782 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$
+ case 789 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression EQUAL_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
break;
- case 783 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$
+ case 790 : if (DEBUG) { System.out.println("EqualityExpression ::= EqualityExpression NOT_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.NOT_EQUAL);
break;
- case 785 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$
+ case 792 : if (DEBUG) { System.out.println("AndExpression ::= AndExpression AND EqualityExpression"); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND);
break;
- case 787 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$
+ case 794 : if (DEBUG) { System.out.println("ExclusiveOrExpression ::= ExclusiveOrExpression XOR..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.XOR);
break;
- case 789 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$
+ case 796 : if (DEBUG) { System.out.println("InclusiveOrExpression ::= InclusiveOrExpression OR..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR);
break;
- case 791 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$
+ case 798 : if (DEBUG) { System.out.println("ConditionalAndExpression ::= ConditionalAndExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND_AND);
break;
- case 793 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
+ case 800 : if (DEBUG) { System.out.println("ConditionalOrExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR_OR);
break;
- case 795 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
+ case 802 : if (DEBUG) { System.out.println("ConditionalExpression ::= ConditionalOrExpression..."); } //$NON-NLS-1$
consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
break;
- case 798 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$
+ case 805 : if (DEBUG) { System.out.println("Assignment ::= PostfixExpression AssignmentOperator..."); } //$NON-NLS-1$
consumeAssignment();
break;
- case 800 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$
+ case 807 : if (DEBUG) { System.out.println("Assignment ::= InvalidArrayInitializerAssignement"); } //$NON-NLS-1$
ignoreExpressionAssignment();
break;
- case 801 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$
+ case 808 : if (DEBUG) { System.out.println("AssignmentOperator ::= EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(EQUAL);
break;
- case 802 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$
+ case 809 : if (DEBUG) { System.out.println("AssignmentOperator ::= MULTIPLY_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(MULTIPLY);
break;
- case 803 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$
+ case 810 : if (DEBUG) { System.out.println("AssignmentOperator ::= DIVIDE_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(DIVIDE);
break;
- case 804 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$
+ case 811 : if (DEBUG) { System.out.println("AssignmentOperator ::= REMAINDER_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(REMAINDER);
break;
- case 805 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$
+ case 812 : if (DEBUG) { System.out.println("AssignmentOperator ::= PLUS_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(PLUS);
break;
- case 806 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$
+ case 813 : if (DEBUG) { System.out.println("AssignmentOperator ::= MINUS_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(MINUS);
break;
- case 807 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ case 814 : if (DEBUG) { System.out.println("AssignmentOperator ::= LEFT_SHIFT_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(LEFT_SHIFT);
break;
- case 808 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ case 815 : if (DEBUG) { System.out.println("AssignmentOperator ::= RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(RIGHT_SHIFT);
break;
- case 809 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
+ case 816 : if (DEBUG) { System.out.println("AssignmentOperator ::= UNSIGNED_RIGHT_SHIFT_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(UNSIGNED_RIGHT_SHIFT);
break;
- case 810 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$
+ case 817 : if (DEBUG) { System.out.println("AssignmentOperator ::= AND_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(AND);
break;
- case 811 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$
+ case 818 : if (DEBUG) { System.out.println("AssignmentOperator ::= XOR_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(XOR);
break;
- case 812 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$
+ case 819 : if (DEBUG) { System.out.println("AssignmentOperator ::= OR_EQUAL"); } //$NON-NLS-1$
consumeAssignmentOperator(OR);
break;
- case 813 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$
+ case 820 : if (DEBUG) { System.out.println("Expression ::= AssignmentExpression"); } //$NON-NLS-1$
consumeExpression();
break;
- case 816 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$
+ case 823 : if (DEBUG) { System.out.println("Expressionopt ::="); } //$NON-NLS-1$
consumeEmptyExpression();
break;
- case 821 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$
+ case 828 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyClassBodyDeclarationsopt();
break;
- case 822 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ case 829 : if (DEBUG) { System.out.println("ClassBodyDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
consumeClassBodyDeclarationsopt();
break;
- case 823 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$
+ case 830 : if (DEBUG) { System.out.println("Modifiersopt ::="); } //$NON-NLS-1$
consumeDefaultModifiers();
break;
- case 824 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$
+ case 831 : if (DEBUG) { System.out.println("Modifiersopt ::= Modifiers"); } //$NON-NLS-1$
consumeModifiers();
break;
- case 825 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$
+ case 832 : if (DEBUG) { System.out.println("BlockStatementsopt ::="); } //$NON-NLS-1$
consumeEmptyBlockStatementsopt();
break;
- case 827 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$
+ case 834 : if (DEBUG) { System.out.println("Dimsopt ::="); } //$NON-NLS-1$
consumeEmptyDimsopt();
break;
- case 829 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$
+ case 836 : if (DEBUG) { System.out.println("ArgumentListopt ::="); } //$NON-NLS-1$
consumeEmptyArgumentListopt();
break;
- case 833 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$
+ case 840 : if (DEBUG) { System.out.println("FormalParameterListopt ::="); } //$NON-NLS-1$
consumeFormalParameterListopt();
break;
- case 840 : if (DEBUG) { System.out.println("ClassHeaderPermittedSubclasses ::=..."); } //$NON-NLS-1$
+ case 847 : if (DEBUG) { System.out.println("ClassHeaderPermittedSubclasses ::=..."); } //$NON-NLS-1$
consumeClassHeaderPermittedSubclasses();
break;
- case 843 : if (DEBUG) { System.out.println("InterfaceHeaderPermittedSubClassesAndSubInterfaces ::="); } //$NON-NLS-1$
+ case 850 : if (DEBUG) { System.out.println("InterfaceHeaderPermittedSubClassesAndSubInterfaces ::="); } //$NON-NLS-1$
consumeInterfaceHeaderPermittedSubClassesAndSubInterfaces();
break;
- case 844 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$
+ case 851 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyInterfaceMemberDeclarationsopt();
break;
- case 845 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ case 852 : if (DEBUG) { System.out.println("InterfaceMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
consumeInterfaceMemberDeclarationsopt();
break;
- case 846 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$
+ case 853 : if (DEBUG) { System.out.println("NestedType ::="); } //$NON-NLS-1$
consumeNestedType();
break;
- case 847 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$
+ case 854 : if (DEBUG) { System.out.println("ForInitopt ::="); } //$NON-NLS-1$
consumeEmptyForInitopt();
break;
- case 849 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$
+ case 856 : if (DEBUG) { System.out.println("ForUpdateopt ::="); } //$NON-NLS-1$
consumeEmptyForUpdateopt();
break;
- case 853 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$
+ case 860 : if (DEBUG) { System.out.println("Catchesopt ::="); } //$NON-NLS-1$
consumeEmptyCatchesopt();
break;
- case 855 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$
+ case 862 : if (DEBUG) { System.out.println("EnumDeclaration ::= EnumHeader EnumBody"); } //$NON-NLS-1$
consumeEnumDeclaration();
break;
- case 856 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$
+ case 863 : if (DEBUG) { System.out.println("EnumHeader ::= EnumHeaderName ClassHeaderImplementsopt"); } //$NON-NLS-1$
consumeEnumHeader();
break;
- case 857 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$
+ case 864 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier"); } //$NON-NLS-1$
consumeEnumHeaderName();
break;
- case 858 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$
+ case 865 : if (DEBUG) { System.out.println("EnumHeaderName ::= Modifiersopt enum Identifier..."); } //$NON-NLS-1$
consumeEnumHeaderNameWithTypeParameters();
break;
- case 859 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$
+ case 866 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumBodyDeclarationsopt RBRACE"); } //$NON-NLS-1$
consumeEnumBodyNoConstants();
break;
- case 860 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$
+ case 867 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE COMMA EnumBodyDeclarationsopt..."); } //$NON-NLS-1$
consumeEnumBodyNoConstants();
break;
- case 861 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$
+ case 868 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants COMMA..."); } //$NON-NLS-1$
consumeEnumBodyWithConstants();
break;
- case 862 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$
+ case 869 : if (DEBUG) { System.out.println("EnumBody ::= LBRACE EnumConstants..."); } //$NON-NLS-1$
consumeEnumBodyWithConstants();
break;
- case 864 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$
+ case 871 : if (DEBUG) { System.out.println("EnumConstants ::= EnumConstants COMMA EnumConstant"); } //$NON-NLS-1$
consumeEnumConstants();
break;
- case 865 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
+ case 872 : if (DEBUG) { System.out.println("EnumConstantHeaderName ::= Modifiersopt Identifier"); } //$NON-NLS-1$
consumeEnumConstantHeaderName();
break;
- case 866 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$
+ case 873 : if (DEBUG) { System.out.println("EnumConstantHeader ::= EnumConstantHeaderName..."); } //$NON-NLS-1$
consumeEnumConstantHeader();
break;
- case 867 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$
+ case 874 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader ForceNoDiet..."); } //$NON-NLS-1$
consumeEnumConstantWithClassBody();
break;
- case 868 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$
+ case 875 : if (DEBUG) { System.out.println("EnumConstant ::= EnumConstantHeader"); } //$NON-NLS-1$
consumeEnumConstantNoClassBody();
break;
- case 869 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
+ case 876 : if (DEBUG) { System.out.println("Arguments ::= LPAREN ArgumentListopt RPAREN"); } //$NON-NLS-1$
consumeArguments();
break;
- case 870 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$
+ case 877 : if (DEBUG) { System.out.println("Argumentsopt ::="); } //$NON-NLS-1$
consumeEmptyArguments();
break;
- case 872 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$
+ case 879 : if (DEBUG) { System.out.println("EnumDeclarations ::= SEMICOLON ClassBodyDeclarationsopt"); } //$NON-NLS-1$
consumeEnumDeclarations();
break;
- case 873 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$
+ case 880 : if (DEBUG) { System.out.println("EnumBodyDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyEnumDeclarations();
break;
- case 875 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$
+ case 882 : if (DEBUG) { System.out.println("EnhancedForStatement ::= EnhancedForStatementHeader..."); } //$NON-NLS-1$
consumeEnhancedForStatement();
break;
- case 876 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$
+ case 883 : if (DEBUG) { System.out.println("EnhancedForStatementNoShortIf ::=..."); } //$NON-NLS-1$
consumeEnhancedForStatement();
break;
- case 877 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$
+ case 884 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Type..."); } //$NON-NLS-1$
consumeEnhancedForStatementHeaderInit(false);
break;
- case 878 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$
+ case 885 : if (DEBUG) { System.out.println("EnhancedForStatementHeaderInit ::= for LPAREN Modifiers"); } //$NON-NLS-1$
consumeEnhancedForStatementHeaderInit(true);
break;
- case 879 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$
+ case 886 : if (DEBUG) { System.out.println("EnhancedForStatementHeader ::=..."); } //$NON-NLS-1$
consumeEnhancedForStatementHeader();
break;
- case 880 : if (DEBUG) { System.out.println("SingleBaseImportDeclaration ::=..."); } //$NON-NLS-1$
+ case 887 : if (DEBUG) { System.out.println("SingleBaseImportDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 881 : if (DEBUG) { System.out.println("SingleBaseImportDeclarationName ::= import base Name"); } //$NON-NLS-1$
+ case 888 : if (DEBUG) { System.out.println("SingleBaseImportDeclarationName ::= import base Name"); } //$NON-NLS-1$
consumeSingleBaseImportDeclarationName();
break;
- case 882 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$
+ case 889 : if (DEBUG) { System.out.println("SingleStaticImportDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 883 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$
+ case 890 : if (DEBUG) { System.out.println("SingleStaticImportDeclarationName ::= import static Name"); } //$NON-NLS-1$
consumeSingleStaticImportDeclarationName();
break;
- case 884 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
+ case 891 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclaration ::=..."); } //$NON-NLS-1$
consumeImportDeclaration();
break;
- case 885 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$
+ case 892 : if (DEBUG) { System.out.println("StaticImportOnDemandDeclarationName ::= import static..."); } //$NON-NLS-1$
consumeStaticImportOnDemandDeclarationName();
break;
- case 886 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
+ case 893 : if (DEBUG) { System.out.println("TypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
consumeTypeArguments();
break;
- case 887 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
+ case 894 : if (DEBUG) { System.out.println("OnlyTypeArguments ::= LESS TypeArgumentList1"); } //$NON-NLS-1$
consumeOnlyTypeArguments();
break;
- case 889 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ case 896 : if (DEBUG) { System.out.println("TypeArgumentList1 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
consumeTypeArgumentList1();
break;
- case 891 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$
+ case 898 : if (DEBUG) { System.out.println("TypeArgumentList ::= TypeArgumentList COMMA TypeArgument"); } //$NON-NLS-1$
consumeTypeArgumentList();
break;
- case 892 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$
+ case 899 : if (DEBUG) { System.out.println("TypeArgument ::= ReferenceType"); } //$NON-NLS-1$
consumeTypeArgument();
break;
- case 898 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument -> AnyTypeAnchor"); } //$NON-NLS-1$
+ case 905 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument -> AnyTypeAnchor"); } //$NON-NLS-1$
confirmTypeAnchor();
break;
- case 899 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument ::=..."); } //$NON-NLS-1$
+ case 906 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument ::=..."); } //$NON-NLS-1$
consumeTypeArgumentFromAnchor();
break;
- case 900 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument ::=..."); } //$NON-NLS-1$
+ case 907 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 901 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument1 ::= AnyTypeAnchor..."); } //$NON-NLS-1$
+ case 908 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument1 ::= AnyTypeAnchor..."); } //$NON-NLS-1$
confirmTypeAnchor();
break;
- case 902 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument1 ::=..."); } //$NON-NLS-1$
+ case 909 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument1 ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 903 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument1 ::=..."); } //$NON-NLS-1$
+ case 910 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument1 ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 904 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument2 ::= AnyTypeAnchor..."); } //$NON-NLS-1$
+ case 911 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument2 ::= AnyTypeAnchor..."); } //$NON-NLS-1$
confirmTypeAnchor();
break;
- case 905 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument2 ::=..."); } //$NON-NLS-1$
+ case 912 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument2 ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 906 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument2 ::=..."); } //$NON-NLS-1$
+ case 913 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument2 ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 907 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument3 ::= AnyTypeAnchor..."); } //$NON-NLS-1$
+ case 914 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument3 ::= AnyTypeAnchor..."); } //$NON-NLS-1$
confirmTypeAnchor();
break;
- case 908 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument3 ::=..."); } //$NON-NLS-1$
+ case 915 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument3 ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 909 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument3 ::=..."); } //$NON-NLS-1$
+ case 916 : if (DEBUG) { System.out.println("TypeAnchorOrAnnotatedTypeArgument3 ::=..."); } //$NON-NLS-1$
consumeAnnotationsOnTypeArgumentFromAnchor();
break;
- case 910 : if (DEBUG) { System.out.println("NotAnAnchor ::="); } //$NON-NLS-1$
+ case 917 : if (DEBUG) { System.out.println("NotAnAnchor ::="); } //$NON-NLS-1$
convertTypeAnchor(0);
break;
- case 911 : if (DEBUG) { System.out.println("NotAnAnchor ::= LPAREN SingleMemberAnnotationMemberValue"); } //$NON-NLS-1$
+ case 918 : if (DEBUG) { System.out.println("NotAnAnchor ::= LPAREN SingleMemberAnnotationMemberValue"); } //$NON-NLS-1$
convertTypeAnchor(1);
break;
- case 912 : if (DEBUG) { System.out.println("NotAnAnchor ::= LPAREN MemberValuePairsopt RPAREN"); } //$NON-NLS-1$
+ case 919 : if (DEBUG) { System.out.println("NotAnAnchor ::= LPAREN MemberValuePairsopt RPAREN"); } //$NON-NLS-1$
convertTypeAnchor(2);
break;
- case 915 : if (DEBUG) { System.out.println("TentativeTypeAnchor ::= ATOT UnannotatableName"); } //$NON-NLS-1$
+ case 922 : if (DEBUG) { System.out.println("TentativeTypeAnchor ::= ATOT UnannotatableName"); } //$NON-NLS-1$
consumeTypeAnchor(false);
break;
- case 916 : if (DEBUG) { System.out.println("TypeAnchor ::= ATOT base"); } //$NON-NLS-1$
+ case 923 : if (DEBUG) { System.out.println("TypeAnchor ::= ATOT base"); } //$NON-NLS-1$
consumeTypeAnchor(true);
break;
- case 917 : if (DEBUG) { System.out.println("TypeAnchor ::= ATOT this"); } //$NON-NLS-1$
+ case 924 : if (DEBUG) { System.out.println("TypeAnchor ::= ATOT this"); } //$NON-NLS-1$
skipThisAnchor();
break;
- case 918 : if (DEBUG) { System.out.println("TypeAnchor ::= ATOT UnannotatableName DOT base"); } //$NON-NLS-1$
+ case 925 : if (DEBUG) { System.out.println("TypeAnchor ::= ATOT UnannotatableName DOT base"); } //$NON-NLS-1$
consumeQualifiedBaseTypeAnchor();
break;
- case 921 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$
+ case 928 : if (DEBUG) { System.out.println("ReferenceType1 ::= ReferenceType GREATER"); } //$NON-NLS-1$
consumeReferenceType1();
break;
- case 922 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
+ case 929 : if (DEBUG) { System.out.println("ReferenceType1 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
consumeTypeArgumentReferenceType1();
break;
- case 924 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ case 931 : if (DEBUG) { System.out.println("TypeArgumentList2 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
consumeTypeArgumentList2();
break;
- case 927 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 934 : if (DEBUG) { System.out.println("ReferenceType2 ::= ReferenceType RIGHT_SHIFT"); } //$NON-NLS-1$
consumeReferenceType2();
break;
- case 928 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
+ case 935 : if (DEBUG) { System.out.println("ReferenceType2 ::= ClassOrInterface LESS..."); } //$NON-NLS-1$
consumeTypeArgumentReferenceType2();
break;
- case 930 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
+ case 937 : if (DEBUG) { System.out.println("TypeArgumentList3 ::= TypeArgumentList COMMA..."); } //$NON-NLS-1$
consumeTypeArgumentList3();
break;
- case 933 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 940 : if (DEBUG) { System.out.println("ReferenceType3 ::= ReferenceType UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
consumeReferenceType3();
break;
- case 934 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION"); } //$NON-NLS-1$
+ case 941 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION"); } //$NON-NLS-1$
consumeWildcard();
break;
- case 935 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION WildcardBounds"); } //$NON-NLS-1$
+ case 942 : if (DEBUG) { System.out.println("Wildcard ::= TypeAnnotationsopt QUESTION WildcardBounds"); } //$NON-NLS-1$
consumeWildcardWithBounds();
break;
- case 936 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$
+ case 943 : if (DEBUG) { System.out.println("WildcardBounds ::= extends ReferenceType"); } //$NON-NLS-1$
consumeWildcardBoundsExtends();
break;
- case 937 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$
+ case 944 : if (DEBUG) { System.out.println("WildcardBounds ::= super ReferenceType"); } //$NON-NLS-1$
consumeWildcardBoundsSuper();
break;
- case 938 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION GREATER"); } //$NON-NLS-1$
+ case 945 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION GREATER"); } //$NON-NLS-1$
consumeWildcard1();
break;
- case 939 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 946 : if (DEBUG) { System.out.println("Wildcard1 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard1WithBounds();
break;
- case 940 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$
+ case 947 : if (DEBUG) { System.out.println("WildcardBounds1 ::= extends ReferenceType1"); } //$NON-NLS-1$
consumeWildcardBounds1Extends();
break;
- case 941 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$
+ case 948 : if (DEBUG) { System.out.println("WildcardBounds1 ::= super ReferenceType1"); } //$NON-NLS-1$
consumeWildcardBounds1Super();
break;
- case 942 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 949 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION RIGHT_SHIFT"); } //$NON-NLS-1$
consumeWildcard2();
break;
- case 943 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 950 : if (DEBUG) { System.out.println("Wildcard2 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard2WithBounds();
break;
- case 944 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$
+ case 951 : if (DEBUG) { System.out.println("WildcardBounds2 ::= extends ReferenceType2"); } //$NON-NLS-1$
consumeWildcardBounds2Extends();
break;
- case 945 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$
+ case 952 : if (DEBUG) { System.out.println("WildcardBounds2 ::= super ReferenceType2"); } //$NON-NLS-1$
consumeWildcardBounds2Super();
break;
- case 946 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 953 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard3();
break;
- case 947 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
+ case 954 : if (DEBUG) { System.out.println("Wildcard3 ::= TypeAnnotationsopt QUESTION..."); } //$NON-NLS-1$
consumeWildcard3WithBounds();
break;
- case 948 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$
+ case 955 : if (DEBUG) { System.out.println("WildcardBounds3 ::= extends ReferenceType3"); } //$NON-NLS-1$
consumeWildcardBounds3Extends();
break;
- case 949 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$
+ case 956 : if (DEBUG) { System.out.println("WildcardBounds3 ::= super ReferenceType3"); } //$NON-NLS-1$
consumeWildcardBounds3Super();
break;
- case 950 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotationsopt Identifier"); } //$NON-NLS-1$
+ case 957 : if (DEBUG) { System.out.println("TypeParameterHeader ::= TypeAnnotationsopt Identifier"); } //$NON-NLS-1$
consumeTypeParameterHeader();
break;
- case 951 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$
+ case 958 : if (DEBUG) { System.out.println("TypeParameters ::= LESS TypeParameterList1"); } //$NON-NLS-1$
consumeTypeParameters();
break;
- case 953 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
+ case 960 : if (DEBUG) { System.out.println("TypeParameterList ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
consumeTypeParameterList();
break;
- case 955 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 962 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameterWithExtends();
break;
- case 956 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 963 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameterWithExtendsAndBounds();
break;
- case 957 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader base ReferenceType"); } //$NON-NLS-1$
+ case 964 : if (DEBUG) { System.out.println("TypeParameter ::= TypeParameterHeader base ReferenceType"); } //$NON-NLS-1$
consumeTypeParameterWithBase();
break;
- case 961 : if (DEBUG) { System.out.println("TypeValueParameter ::= TypeParameterHeader Identifier"); } //$NON-NLS-1$
+ case 968 : if (DEBUG) { System.out.println("TypeValueParameter ::= TypeParameterHeader Identifier"); } //$NON-NLS-1$
consumeTypeValueParameter();
break;
- case 966 : if (DEBUG) { System.out.println("TypeBoundOpt ::= extends ReferenceType"); } //$NON-NLS-1$
+ case 973 : if (DEBUG) { System.out.println("TypeBoundOpt ::= extends ReferenceType"); } //$NON-NLS-1$
consumeBoundsOfAnchoredTypeParameter();
break;
- case 968 : if (DEBUG) { System.out.println("TypeBoundOpt1 ::= extends ReferenceType1"); } //$NON-NLS-1$
+ case 975 : if (DEBUG) { System.out.println("TypeBoundOpt1 ::= extends ReferenceType1"); } //$NON-NLS-1$
consumeBoundsOfAnchoredTypeParameter();
break;
- case 969 : if (DEBUG) { System.out.println("AnchoredTypeParameterHeader0 ::= TypeParameterHeader..."); } //$NON-NLS-1$
+ case 976 : if (DEBUG) { System.out.println("AnchoredTypeParameterHeader0 ::= TypeParameterHeader..."); } //$NON-NLS-1$
consumeAnchoredTypeParameter();
break;
- case 971 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$
+ case 978 : if (DEBUG) { System.out.println("AdditionalBoundList ::= AdditionalBoundList..."); } //$NON-NLS-1$
consumeAdditionalBoundList();
break;
- case 972 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$
+ case 979 : if (DEBUG) { System.out.println("AdditionalBound ::= AND ReferenceType"); } //$NON-NLS-1$
consumeAdditionalBound();
break;
- case 974 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
+ case 981 : if (DEBUG) { System.out.println("TypeParameterList1 ::= TypeParameterList COMMA..."); } //$NON-NLS-1$
consumeTypeParameterList1();
break;
- case 975 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$
+ case 982 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader GREATER"); } //$NON-NLS-1$
consumeTypeParameter1();
break;
- case 976 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 983 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameter1WithExtends();
break;
- case 977 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader base..."); } //$NON-NLS-1$
+ case 984 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader base..."); } //$NON-NLS-1$
consumeTypeParameter1WithBase();
break;
- case 978 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
+ case 985 : if (DEBUG) { System.out.println("TypeParameter1 ::= TypeParameterHeader extends..."); } //$NON-NLS-1$
consumeTypeParameter1WithExtendsAndBounds();
break;
- case 980 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$
+ case 987 : if (DEBUG) { System.out.println("AdditionalBoundList1 ::= AdditionalBoundList..."); } //$NON-NLS-1$
consumeAdditionalBoundList1();
break;
- case 981 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$
+ case 988 : if (DEBUG) { System.out.println("AdditionalBound1 ::= AND ReferenceType1"); } //$NON-NLS-1$
consumeAdditionalBound1();
break;
- case 987 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$
+ case 994 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= PLUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.PLUS);
break;
- case 988 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$
+ case 995 : if (DEBUG) { System.out.println("UnaryExpression_NotName ::= MINUS PushPosition..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.MINUS);
break;
- case 991 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$
+ case 998 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= TWIDDLE..."); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.TWIDDLE);
break;
- case 992 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$
+ case 999 : if (DEBUG) { System.out.println("UnaryExpressionNotPlusMinus_NotName ::= NOT PushPosition"); } //$NON-NLS-1$
consumeUnaryExpression(OperatorIds.NOT);
break;
- case 995 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1002 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MULTIPLY);
break;
- case 996 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$
+ case 1003 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name MULTIPLY..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.MULTIPLY);
break;
- case 997 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1004 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.DIVIDE);
break;
- case 998 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$
+ case 1005 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name DIVIDE..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.DIVIDE);
break;
- case 999 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1006 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.REMAINDER);
break;
- case 1000 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$
+ case 1007 : if (DEBUG) { System.out.println("MultiplicativeExpression_NotName ::= Name REMAINDER..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.REMAINDER);
break;
- case 1002 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1009 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.PLUS);
break;
- case 1003 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$
+ case 1010 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name PLUS..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.PLUS);
break;
- case 1004 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1011 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.MINUS);
break;
- case 1005 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$
+ case 1012 : if (DEBUG) { System.out.println("AdditiveExpression_NotName ::= Name MINUS..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.MINUS);
break;
- case 1007 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ case 1014 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LEFT_SHIFT);
break;
- case 1008 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$
+ case 1015 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name LEFT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.LEFT_SHIFT);
break;
- case 1009 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ case 1016 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.RIGHT_SHIFT);
break;
- case 1010 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$
+ case 1017 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name RIGHT_SHIFT..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.RIGHT_SHIFT);
break;
- case 1011 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
+ case 1018 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= ShiftExpression_NotName..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.UNSIGNED_RIGHT_SHIFT);
break;
- case 1012 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
+ case 1019 : if (DEBUG) { System.out.println("ShiftExpression_NotName ::= Name UNSIGNED_RIGHT_SHIFT"); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.UNSIGNED_RIGHT_SHIFT);
break;
- case 1014 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1021 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS);
break;
- case 1015 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$
+ case 1022 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.LESS);
break;
- case 1016 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1023 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER);
break;
- case 1017 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$
+ case 1024 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.GREATER);
break;
- case 1018 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1025 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.LESS_EQUAL);
break;
- case 1019 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$
+ case 1026 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name LESS_EQUAL..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.LESS_EQUAL);
break;
- case 1020 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1027 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.GREATER_EQUAL);
break;
- case 1021 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$
+ case 1028 : if (DEBUG) { System.out.println("RelationalExpression_NotName ::= Name GREATER_EQUAL..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.GREATER_EQUAL);
break;
- case 1023 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name InstanceofRHS"); } //$NON-NLS-1$
+ case 1030 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::= Name InstanceofRHS"); } //$NON-NLS-1$
consumeInstanceOfExpressionWithName();
break;
- case 1024 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1031 : if (DEBUG) { System.out.println("InstanceofExpression_NotName ::=..."); } //$NON-NLS-1$
consumeInstanceOfExpression();
break;
- case 1026 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1033 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.EQUAL_EQUAL);
break;
- case 1027 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$
+ case 1034 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name EQUAL_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpressionWithName(OperatorIds.EQUAL_EQUAL);
break;
- case 1028 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1035 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::=..."); } //$NON-NLS-1$
consumeEqualityExpression(OperatorIds.NOT_EQUAL);
break;
- case 1029 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$
+ case 1036 : if (DEBUG) { System.out.println("EqualityExpression_NotName ::= Name NOT_EQUAL..."); } //$NON-NLS-1$
consumeEqualityExpressionWithName(OperatorIds.NOT_EQUAL);
break;
- case 1031 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$
+ case 1038 : if (DEBUG) { System.out.println("AndExpression_NotName ::= AndExpression_NotName AND..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND);
break;
- case 1032 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$
+ case 1039 : if (DEBUG) { System.out.println("AndExpression_NotName ::= Name AND EqualityExpression"); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.AND);
break;
- case 1034 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1041 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.XOR);
break;
- case 1035 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR..."); } //$NON-NLS-1$
+ case 1042 : if (DEBUG) { System.out.println("ExclusiveOrExpression_NotName ::= Name XOR..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.XOR);
break;
- case 1037 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1044 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR);
break;
- case 1038 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$
+ case 1045 : if (DEBUG) { System.out.println("InclusiveOrExpression_NotName ::= Name OR..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.OR);
break;
- case 1040 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1047 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.AND_AND);
break;
- case 1041 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$
+ case 1048 : if (DEBUG) { System.out.println("ConditionalAndExpression_NotName ::= Name AND_AND..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.AND_AND);
break;
- case 1043 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1050 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::=..."); } //$NON-NLS-1$
consumeBinaryExpression(OperatorIds.OR_OR);
break;
- case 1044 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$
+ case 1051 : if (DEBUG) { System.out.println("ConditionalOrExpression_NotName ::= Name OR_OR..."); } //$NON-NLS-1$
consumeBinaryExpressionWithName(OperatorIds.OR_OR);
break;
- case 1046 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$
+ case 1053 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::=..."); } //$NON-NLS-1$
consumeConditionalExpression(OperatorIds.QUESTIONCOLON) ;
break;
- case 1047 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$
+ case 1054 : if (DEBUG) { System.out.println("ConditionalExpression_NotName ::= Name QUESTION..."); } //$NON-NLS-1$
consumeConditionalExpressionWithName(OperatorIds.QUESTIONCOLON) ;
break;
- case 1051 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
+ case 1058 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderName() ;
break;
- case 1052 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
+ case 1059 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= Modifiers AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;
break;
- case 1053 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
+ case 1060 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() ;
break;
- case 1054 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
+ case 1061 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeaderName ::= AT..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeaderName() ;
break;
- case 1055 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$
+ case 1062 : if (DEBUG) { System.out.println("AnnotationTypeDeclarationHeader ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclarationHeader() ;
break;
- case 1056 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$
+ case 1063 : if (DEBUG) { System.out.println("AnnotationTypeDeclaration ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeDeclaration() ;
break;
- case 1058 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$
+ case 1065 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::="); } //$NON-NLS-1$
consumeEmptyAnnotationTypeMemberDeclarationsopt() ;
break;
- case 1059 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
+ case 1066 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarationsopt ::= NestedType..."); } //$NON-NLS-1$
consumeAnnotationTypeMemberDeclarationsopt() ;
break;
- case 1061 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$
+ case 1068 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclarations ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeMemberDeclarations() ;
break;
- case 1062 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 1069 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
consumeMethodHeaderNameWithTypeParameters(true);
break;
- case 1063 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 1070 : if (DEBUG) { System.out.println("AnnotationMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeMethodHeaderName(true);
break;
- case 1064 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$
+ case 1071 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::="); } //$NON-NLS-1$
consumeEmptyMethodHeaderDefaultValue() ;
break;
- case 1065 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$
+ case 1072 : if (DEBUG) { System.out.println("AnnotationMethodHeaderDefaultValueopt ::= DefaultValue"); } //$NON-NLS-1$
consumeMethodHeaderDefaultValue();
break;
- case 1066 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName"); } //$NON-NLS-1$
+ case 1073 : if (DEBUG) { System.out.println("AnnotationMethodHeader ::= AnnotationMethodHeaderName"); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 1067 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$
+ case 1074 : if (DEBUG) { System.out.println("AnnotationTypeMemberDeclaration ::=..."); } //$NON-NLS-1$
consumeAnnotationTypeMemberDeclaration() ;
break;
- case 1075 : if (DEBUG) { System.out.println("AnnotationName ::= AT UnannotatableName"); } //$NON-NLS-1$
+ case 1082 : if (DEBUG) { System.out.println("AnnotationName ::= AT UnannotatableName"); } //$NON-NLS-1$
consumeAnnotationName() ;
break;
- case 1076 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
+ case 1083 : if (DEBUG) { System.out.println("NormalAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
consumeNormalAnnotation(false) ;
break;
- case 1077 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$
+ case 1084 : if (DEBUG) { System.out.println("MemberValuePairsopt ::="); } //$NON-NLS-1$
consumeEmptyMemberValuePairsopt() ;
break;
- case 1080 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$
+ case 1087 : if (DEBUG) { System.out.println("MemberValuePairs ::= MemberValuePairs COMMA..."); } //$NON-NLS-1$
consumeMemberValuePairs() ;
break;
- case 1081 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue"); } //$NON-NLS-1$
+ case 1088 : if (DEBUG) { System.out.println("MemberValuePair ::= SimpleName EQUAL EnterMemberValue"); } //$NON-NLS-1$
consumeMemberValuePair() ;
break;
- case 1082 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$
+ case 1089 : if (DEBUG) { System.out.println("EnterMemberValue ::="); } //$NON-NLS-1$
consumeEnterMemberValue() ;
break;
- case 1083 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$
+ case 1090 : if (DEBUG) { System.out.println("ExitMemberValue ::="); } //$NON-NLS-1$
consumeExitMemberValue() ;
break;
- case 1085 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$
+ case 1092 : if (DEBUG) { System.out.println("MemberValue ::= Name"); } //$NON-NLS-1$
consumeMemberValueAsName() ;
break;
- case 1088 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 1095 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeMemberValueArrayInitializer() ;
break;
- case 1089 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 1096 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeMemberValueArrayInitializer() ;
break;
- case 1090 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 1097 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeEmptyMemberValueArrayInitializer() ;
break;
- case 1091 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
+ case 1098 : if (DEBUG) { System.out.println("MemberValueArrayInitializer ::=..."); } //$NON-NLS-1$
consumeEmptyMemberValueArrayInitializer() ;
break;
- case 1092 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$
+ case 1099 : if (DEBUG) { System.out.println("EnterMemberValueArrayInitializer ::="); } //$NON-NLS-1$
consumeEnterMemberValueArrayInitializer() ;
break;
- case 1094 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$
+ case 1101 : if (DEBUG) { System.out.println("MemberValues ::= MemberValues COMMA MemberValue"); } //$NON-NLS-1$
consumeMemberValues() ;
break;
- case 1095 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$
+ case 1102 : if (DEBUG) { System.out.println("MarkerAnnotation ::= AnnotationName"); } //$NON-NLS-1$
consumeMarkerAnnotation(false) ;
break;
- case 1096 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$
+ case 1103 : if (DEBUG) { System.out.println("SingleMemberAnnotationMemberValue ::= MemberValue"); } //$NON-NLS-1$
consumeSingleMemberAnnotationMemberValue() ;
break;
- case 1097 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
+ case 1104 : if (DEBUG) { System.out.println("SingleMemberAnnotation ::= AnnotationName LPAREN..."); } //$NON-NLS-1$
consumeSingleMemberAnnotation(false) ;
break;
- case 1098 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 1105 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt..."); } //$NON-NLS-1$
consumeRecoveryMethodHeaderNameWithTypeParameters();
break;
- case 1099 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
+ case 1106 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= Modifiersopt Type..."); } //$NON-NLS-1$
consumeRecoveryMethodHeaderName();
break;
- case 1100 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
+ case 1107 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault..."); } //$NON-NLS-1$
consumeRecoveryMethodHeaderNameWithTypeParameters();
break;
- case 1101 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault Type"); } //$NON-NLS-1$
+ case 1108 : if (DEBUG) { System.out.println("RecoveryMethodHeaderName ::= ModifiersWithDefault Type"); } //$NON-NLS-1$
consumeRecoveryMethodHeaderName();
break;
- case 1102 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
+ case 1109 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 1103 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
+ case 1110 : if (DEBUG) { System.out.println("RecoveryMethodHeader ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodHeader();
break;
- case 1106 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= RecoveryCallinBindingLeftLong"); } //$NON-NLS-1$
+ case 1113 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= RecoveryCallinBindingLeftLong"); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 1107 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
+ case 1114 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 1108 : if (DEBUG) { System.out.println("RecoveryCallinBindingLeftLong ::=..."); } //$NON-NLS-1$
+ case 1115 : if (DEBUG) { System.out.println("RecoveryCallinBindingLeftLong ::=..."); } //$NON-NLS-1$
consumeCallinBindingLeft(true);
break;
- case 1109 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 1116 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt..."); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 1110 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
+ case 1117 : if (DEBUG) { System.out.println("RecoveryCallinHeader ::= Modifiersopt CallinLabel..."); } //$NON-NLS-1$
consumeCallinHeader();
break;
- case 1111 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::=..."); } //$NON-NLS-1$
+ case 1118 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::=..."); } //$NON-NLS-1$
consumeCalloutHeader();
break;
- case 1112 : if (DEBUG) { System.out.println("RecoveryCalloutBindingLeftLong ::=..."); } //$NON-NLS-1$
+ case 1119 : if (DEBUG) { System.out.println("RecoveryCalloutBindingLeftLong ::=..."); } //$NON-NLS-1$
consumeCalloutBindingLeft(true);
break;
- case 1113 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::=..."); } //$NON-NLS-1$
+ case 1120 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::=..."); } //$NON-NLS-1$
consumeCalloutHeader();
break;
- case 1114 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= Modifiersopt..."); } //$NON-NLS-1$
+ case 1121 : if (DEBUG) { System.out.println("RecoveryCalloutHeader ::= Modifiersopt..."); } //$NON-NLS-1$
consumeCalloutHeader();
break;
- case 1115 : if (DEBUG) { System.out.println("RecoveryMethodSpecLong ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
+ case 1122 : if (DEBUG) { System.out.println("RecoveryMethodSpecLong ::= RecoveryMethodHeaderName..."); } //$NON-NLS-1$
consumeMethodSpecLong(false);
break;
@@ -12511,6 +12514,9 @@ protected void consumeCaseLabelElement(CaseLabelKind kind) {
}
this.scanner.multiCaseLabelComma = this.currentToken == TerminalTokens.TokenNameCOMMA;
}
+protected void consumeCaseLabelElementPattern() {
+ // Todo: check if anything to be done for patterns
+}
protected void consumeCaseLabelElements() {
concatExpressionLists();
}
@@ -12695,6 +12701,9 @@ protected void consumeToken(int type) {
checkAndSetModifiers(ExtraCompilerModifiers.AccSealed);
pushOnExpressionStackLengthStack(0);
break;
+ case TokenNameRestrictedIdentifierWhen :
+ pushOnIntStack(this.scanner.startPosition);
+ break;
case TokenNametransient :
checkAndSetModifiers(ClassFileConstants.AccTransient);
pushOnExpressionStackLengthStack(0);
@@ -13514,21 +13523,16 @@ protected void consumeTypeParameterWithExtendsAndBounds() {
typeParameter.bits |= (bound.bits & ASTNode.HasTypeAnnotations);
}
}
-protected void consumeGuardedPattern() {
+protected void consumeGuard() {
this.astLengthPtr--;
Pattern pattern = (Pattern) this.astStack[this.astPtr--];
Expression expr = this.expressionStack[this.expressionPtr--];
this.expressionLengthPtr--;
- if (pattern instanceof GuardedPattern) {
- GuardedPattern gPattern = (GuardedPattern) pattern;
- AND_AND_Expression andExpression = new AND_AND_Expression(gPattern.condition, expr, OperatorIds.AND_AND);
- pushOnAstStack(new GuardedPattern(gPattern.primaryPattern, andExpression));
- } else {
- pushOnAstStack(new GuardedPattern(pattern, expr));
- }
+ GuardedPattern gPattern = new GuardedPattern(pattern, expr);
+ gPattern.restrictedIdentifierStart = this.intStack[this.intPtr--];
+ pushOnAstStack(gPattern);
}
protected void consumeTypePattern() {
-
//name
char[] identifierName = this.identifierStack[this.identifierPtr];
long namePosition = this.identifierPositionStack[this.identifierPtr];
@@ -13557,6 +13561,67 @@ protected void consumeTypePattern() {
problemReporter().validateJavaFeatureSupport(JavaFeature.PATTERN_MATCHING_IN_INSTANCEOF, type.sourceStart, local.declarationEnd);
pushOnAstStack(aTypePattern);
}
+protected void consumeRecordPattern() {
+ int length = this.astLengthPtr == -1 ? 0 : this.astLengthStack[this.astLengthPtr--];
+ this.astPtr -= length;
+ TypeReference type = getTypeReference(0);
+ int sourceEnd = this.intStack[this.intPtr--];
+ this.intPtr--;
+ RecordPattern recPattern = new RecordPattern(type, type.sourceStart, sourceEnd);
+ if (length != 0) {
+ Pattern[] patterns = new Pattern[length];
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + 1,
+ patterns,
+ 0,
+ length);
+ recPattern.patterns = patterns;
+ } else {
+ recPattern.patterns = ASTNode.NO_TYPE_PATTERNS;
+ }
+ this.intPtr -= 3; // 2 for '(' and ')' and one for the 0 pushed by consumeReferenceType()
+ problemReporter().validateJavaFeatureSupport(JavaFeature.RECORD_PATTERNS, type.sourceStart, sourceEnd);
+ pushOnAstStack(recPattern);
+}
+protected void consumeRecordPatternWithId() {
+ int length = this.astLengthStack[this.astLengthPtr--];
+ this.astPtr -= length;
+ // Identifier
+ char[] identifierName = this.identifierStack[this.identifierPtr];
+ long namePositions = this.identifierPositionStack[this.identifierPtr];
+ LocalDeclaration local = createLocalDeclaration(identifierName, (int) (namePositions >>> 32), (int) namePositions);
+ this.identifierPtr--;
+ TypeReference type = getTypeReference(0);
+ local.declarationSourceEnd = local.declarationEnd;
+ local.type = type;
+ RecordPattern recPattern = new RecordPattern(local);
+ if (length != 0) {
+ Pattern[] patterns = new Pattern[length];
+ System.arraycopy(
+ this.astStack,
+ this.astPtr + 1,
+ patterns,
+ 0,
+ length);
+ recPattern.patterns = patterns;
+ } else {
+ recPattern.patterns = ASTNode.NO_TYPE_PATTERNS;
+ }
+ this.intPtr -= 3; // 2 for '(' and ')' and one for the 0 pushed by consumeReferenceType()
+ recPattern.sourceStart = this.intStack[this.intPtr--];
+ local.modifiers = this.intStack[this.intPtr--];
+ local.declarationSourceStart = type.sourceStart;
+ problemReporter().validateJavaFeatureSupport(JavaFeature.RECORD_PATTERNS, type.sourceStart, local.declarationEnd);
+ pushOnAstStack(recPattern);
+}
+protected void consumeRecordStructure() {
+ //System.out.println("consumeRecordStructure");
+}
+protected void consumeRecordComponentPatternList() {
+ optimizedConcatNodeLists();
+ //System.out.println("consumeRecordComponentPatternList");
+}
protected void consumeZeroAdditionalBounds() {
if (this.currentToken == TokenNameRPAREN) // Signal zero additional bounds - do this only when the cast type is fully seen (i.e not in error path)
pushOnGenericsLengthStack(0); // Not all stacks are adjusted - this is not meant to be popped by getTypeReference
@@ -13940,6 +14005,9 @@ protected void consumeRecordComponentsopt() {
// RecordComponentsopt ::= $empty
pushOnAstLengthStack(0);
}
+protected void consumeRecordComponentPatternsopt() {
+ pushOnAstLengthStack(0);
+}
protected void consumeRecordComponents() {
// RecordComponents ::= RecordComponents ',' RecordComponent
optimizedConcatNodeLists();
@@ -15610,12 +15678,12 @@ protected boolean moveRecoveryCheckpoint() {
do {
try {
this.scanner.multiCaseLabelComma = false;
- this.scanner.lookBack[0] = this.scanner.lookBack[1] = TokenNameNotAToken; // stay clear of the voodoo in the present method
+ this.scanner.resetLookBack(); // stay clear of the voodoo in the present method
this.nextIgnoredToken = this.scanner.getNextNotFakedToken();
} catch(InvalidInputException e){
pos = this.scanner.currentPosition;
} finally {
- this.scanner.lookBack[0] = this.scanner.lookBack[1] = TokenNameNotAToken; // steer clear of the voodoo in the present method
+ this.scanner.resetLookBack(); // steer clear of the voodoo in the present method
this.scanner.multiCaseLabelComma = false;
}
} while (this.nextIgnoredToken < 0);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
index 66b888277..96fa8aeaf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java
@@ -19,22 +19,22 @@ public interface ParserBasicInformation {
public final static int
// BEGIN_AUTOGENERATED_REGION
- ERROR_SYMBOL = 154,
+ ERROR_SYMBOL = 155,
MAX_NAME_LENGTH = 53,
- NUM_STATES = 1492,
+ NUM_STATES = 1496,
- NT_OFFSET = 154,
- SCOPE_UBOUND = 408,
- SCOPE_SIZE = 409,
- LA_STATE_OFFSET = 21488,
+ NT_OFFSET = 155,
+ SCOPE_UBOUND = 412,
+ SCOPE_SIZE = 413,
+ LA_STATE_OFFSET = 21428,
MAX_LA = 1,
- NUM_RULES = 1115,
- NUM_TERMINALS = 154,
- NUM_NON_TERMINALS = 508,
- NUM_SYMBOLS = 662,
- START_STATE = 1353,
+ NUM_RULES = 1122,
+ NUM_TERMINALS = 155,
+ NUM_NON_TERMINALS = 511,
+ NUM_SYMBOLS = 666,
+ START_STATE = 1299,
EOFT_SYMBOL = 69,
EOLT_SYMBOL = 69,
- ACCEPT_ACTION = 21487,
- ERROR_ACTION = 21488;
+ ACCEPT_ACTION = 21427,
+ ERROR_ACTION = 21428;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
index c6e034923..df2f36595 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java
@@ -367,6 +367,17 @@ public class Scanner implements TerminalTokens {
public boolean returnOnlyGreater = false;
public boolean insideRecovery = false;
+ /**
+ * Look back for the two most recent tokens.
+ * <ul>
+ * <li><code>lookBack[1]</code> is the previous token</li>
+ * <li><code>lookBack[0]</code> is the token before <code>lookBack[1]</code></li>
+ * </ul>
+ * As this look back is intended for resolving ambiguities and conflicts, it ignores whitespace and comments.
+ *
+ * @see #resetLookBack() Reset the look back and clear all stored tokens
+ * @see #addTokenToLookBack(int) Add a token to the look back, removing the oldest entry
+ */
int lookBack[] = new int[2]; // fall back to spring forward.
protected int nextToken = TokenNameNotAToken; // allows for one token push back, only the most recent token can be reliably ungotten.
private VanguardScanner vanguardScanner;
@@ -413,7 +424,8 @@ public Scanner(
this.tokenizeComments = tokenizeComments;
this.tokenizeWhiteSpace = tokenizeWhiteSpace;
this.sourceLevel = sourceLevel;
- this.lookBack[0] = this.lookBack[1] = this.nextToken = TokenNameNotAToken;
+ this.resetLookBack();
+ this.nextToken = TokenNameNotAToken;
this.consumingEllipsisAnnotations = false;
this.complianceLevel = complianceLevel;
this.checkNonExternalizedStringLiterals = checkNonExternalizedStringLiterals;
@@ -1619,8 +1631,7 @@ public int getNextToken() throws InvalidInputException {
}
if (this.activeParser == null) { // anybody interested in the grammatical structure of the program should have registered.
if (token != TokenNameWHITESPACE) {
- this.lookBack[0] = this.lookBack[1];
- this.lookBack[1] = token;
+ addTokenToLookBack(token);
this.multiCaseLabelComma = false;
}
return token;
@@ -1632,8 +1643,7 @@ public int getNextToken() throws InvalidInputException {
} else if (mayBeAtCasePattern(token)) {
token = disambiguateCasePattern(token, this);
}
- this.lookBack[0] = this.lookBack[1];
- this.lookBack[1] = token;
+ addTokenToLookBack(token);
this.multiCaseLabelComma = false;
return token;
}
@@ -3692,7 +3702,8 @@ public void resetTo(int begin, int end, boolean isModuleInfo, ScanContext contex
}
this.commentPtr = -1; // reset comment stack
this.foundTaskCount = 0;
- this.lookBack[0] = this.lookBack[1] = this.nextToken = TokenNameNotAToken;
+ resetLookBack();
+ this.nextToken = TokenNameNotAToken;
this.consumingEllipsisAnnotations = false;
//{ObjectTeams: lookahead on '->':
this._insideParameterMapping = false;
@@ -3702,7 +3713,27 @@ public void resetTo(int begin, int end, boolean isModuleInfo, ScanContext contex
this.scanContext = context == null ? getScanContext(begin) : context;
this.multiCaseLabelComma = false;
}
-
+/**
+ * @see #lookBack
+ */
+final void resetLookBack() {
+ this.lookBack[0] = this.lookBack[1] = TokenNameNotAToken;
+}
+/**
+ * @see #lookBack
+ */
+final void addTokenToLookBack(int newToken) {
+ // ignore whitespace and comments
+ switch (newToken) {
+ case TokenNameWHITESPACE:
+ case TokenNameCOMMENT_LINE:
+ case TokenNameCOMMENT_BLOCK:
+ case TokenNameCOMMENT_JAVADOC:
+ return;
+ }
+ this.lookBack[0] = this.lookBack[1];
+ this.lookBack[1] = newToken;
+}
private ScanContext getScanContext(int begin) {
if (!isInModuleDeclaration())
return ScanContext.INACTIVE;
@@ -4793,8 +4824,14 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
&& (data[++index] == 't')
&& (data[++index] == 'h'))
return TokenNamewith;
- else
//{ObjectTeams: check for with, when keywords
+ else
+/* orig:
+ else if ((data[++index] == 'h')
+ && (data[++index] == 'e')
+ && (data[++index] == 'n'))
+ return disambiguatedRestrictedIdentifierWhen(TokenNameRestrictedIdentifierWhen);
+ :giro */
switch (data[++index]) {
case 'i':
if ( this._isOTSource
@@ -4806,7 +4843,7 @@ private int internalScanIdentifierOrKeyword(int index, int length, char[] data)
if ( this._isOTSource
&& (data[++index] == 'e')
&& (data[++index] == 'n'))
- return TokenNamewhen;
+ return disambiguatedRestrictedIdentifierWhen(TokenNameRestrictedIdentifierWhen);
}
//Markus Witte}
return TokenNameIdentifier;
@@ -5278,6 +5315,8 @@ public String toStringAction(int act) {
switch (act) {
case TokenNameIdentifier :
return "Identifier(" + new String(getCurrentTokenSource()) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+ case TokenNameRestrictedIdentifierWhen :
+ return "when"; //$NON-NLS-1$
case TokenNameRestrictedIdentifierYield :
return "yield"; //$NON-NLS-1$
case TokenNameRestrictedIdentifierrecord :
@@ -5646,6 +5685,7 @@ public static boolean isKeyword(int token) {
case TerminalTokens.TokenNameRestrictedIdentifierrecord:
case TerminalTokens.TokenNameRestrictedIdentifiersealed:
case TerminalTokens.TokenNameRestrictedIdentifierpermits:
+ case TerminalTokens.TokenNameRestrictedIdentifierWhen:
// making explicit - not a (restricted) keyword but restricted identifier.
//$FALL-THROUGH$
default:
@@ -5694,8 +5734,7 @@ private static final class VanguardScanner extends Scanner {
token = TokenNameAT308;
}
}
- this.lookBack[0] = this.lookBack[1];
- this.lookBack[1] = token;
+ this.addTokenToLookBack(token);
this.multiCaseLabelComma = false;
return token == TokenNameEOF ? TokenNameNotAToken : token;
}
@@ -5714,8 +5753,10 @@ private static class Goal {
static int BlockStatementoptRule = 0;
static int YieldStatementRule = 0;
static int SwitchLabelCaseLhsRule = 0;
+ static int GuardRule = 0;
static int[] RestrictedIdentifierSealedRule;
static int[] RestrictedIdentifierPermitsRule;
+ static int[] RestrictedIdentifierWhenRule;
static int[] PatternRules;
static Goal LambdaParameterListGoal;
@@ -5727,12 +5768,15 @@ private static class Goal {
static Goal SwitchLabelCaseLhsGoal;
static Goal RestrictedIdentifierSealedGoal;
static Goal RestrictedIdentifierPermitsGoal;
+ static Goal RestrictedIdentifierWhenGoal;
static Goal PatternGoal;
+ static int[] EMPTY_FOLLOW_SET = new int[0];
static int[] RestrictedIdentifierSealedFollow = { TokenNameclass, TokenNameinterface,
TokenNameenum, TokenNameRestrictedIdentifierrecord };// Note: enum/record allowed as error flagging rules.
static int[] RestrictedIdentifierPermitsFollow = { TokenNameLBRACE };
- static int[] PatternCaseLabelFollow = {TokenNameCOLON, TokenNameARROW, TokenNameCOMMA, TokenNameBeginCaseExpr};
+ static int[] PatternCaseLabelFollow = {TokenNameCOLON, TokenNameARROW, TokenNameCOMMA, TokenNameBeginCaseExpr, TokenNameRestrictedIdentifierWhen};
+ static int[] GuardFollow = EMPTY_FOLLOW_SET;
static {
@@ -5771,17 +5815,18 @@ private static class Goal {
if ("TypePattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
patternStates.add(i);
else
- if ("PrimaryPattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
+ if ("Pattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
patternStates.add(i);
else
- if ("GuardedPattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
+ if ("ParenthesizedPattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
patternStates.add(i);
else
- if ("Pattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
+ if ("RecordPattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
patternStates.add(i);
else
- if ("ParenthesizedPattern".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
- patternStates.add(i);
+ if ("Expression".equals(Parser.name[Parser.non_terminal_index[Parser.lhs[i]]])) //$NON-NLS-1$
+ GuardRule = i;
+
}
RestrictedIdentifierSealedRule = ridSealed.stream().mapToInt(Integer :: intValue).toArray(); // overkill but future-proof
RestrictedIdentifierPermitsRule = ridPermits.stream().mapToInt(Integer :: intValue).toArray();
@@ -5796,6 +5841,7 @@ private static class Goal {
SwitchLabelCaseLhsGoal = new Goal(TokenNameARROW, new int [0], SwitchLabelCaseLhsRule);
RestrictedIdentifierSealedGoal = new Goal(TokenNameRestrictedIdentifiersealed, RestrictedIdentifierSealedFollow, RestrictedIdentifierSealedRule);
RestrictedIdentifierPermitsGoal = new Goal(TokenNameRestrictedIdentifierpermits, RestrictedIdentifierPermitsFollow, RestrictedIdentifierPermitsRule);
+ RestrictedIdentifierWhenGoal = new Goal(TokenNameRestrictedIdentifierWhen, GuardFollow, GuardRule);
PatternGoal = new Goal(TokenNameBeginCaseElement, PatternCaseLabelFollow, PatternRules);
}
@@ -5814,7 +5860,7 @@ private static class Goal {
boolean hasBeenReached(int act, int token) {
/*
- System.out.println("[Goal = " + Parser.name[Parser.non_terminal_index[Parser.lhs[this.rule]]] + "] " + "Saw: " + Parser.name[Parser.non_terminal_index[Parser.lhs[act]]] + "::" + //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ System.out.println("[Goal = " + Parser.name[Parser.non_terminal_index[Parser.lhs[act]]] + "] " + "Saw: " + Parser.name[Parser.non_terminal_index[Parser.lhs[act]]] + "::" + //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
Parser.name[Parser.terminal_index[token]]);
*/
boolean foundRule = false;
@@ -6010,6 +6056,24 @@ protected final boolean mayBeAtCasePattern(int token) {
return (!isInModuleDeclaration() && JavaFeature.PATTERN_MATCHING_IN_SWITCH.isSupported(this.complianceLevel, this.previewEnabled))
&& (token == TokenNamecase || this.multiCaseLabelComma);
}
+protected boolean mayBeAtGuard(int token) {
+ if (isInModuleDeclaration())
+ return false;
+ if (!JavaFeature.PATTERN_MATCHING_IN_SWITCH.isSupported(this.complianceLevel, this.previewEnabled))
+ return false;
+ /*
+ * A simple elimination optimization for some common possible cases. According to the JLS 19 including
+ * patterns-switch and record-patterns Section 14.30.1, a guard may only be preceded by either right parentheses or
+ * an identifier. However, we may still encounter comments, whitespace or the not-a-token token.
+ */
+ switch (this.lookBack[1]) {
+ case TokenNameRPAREN:
+ case TokenNameIdentifier:
+ case TokenNameNotAToken: // TODO is this useful? Some tests start scanning at "when", but this makes no sense as a Pattern is required by the JLS
+ return true;
+ }
+ return false;
+}
protected final boolean mayBeAtBreakPreview() {
return !isInModuleDeclaration() && this.breakPreviewAllowed && this.lookBack[1] != TokenNameARROW;
}
@@ -6114,7 +6178,7 @@ protected final boolean atTypeAnchor() { // Did the '@' we saw just now herald a
public void setActiveParser(ConflictedParser parser) {
this.activeParser = parser;
- this.lookBack[0] = this.lookBack[1] = TokenNameNotAToken; // no hand me downs please.
+ this.resetLookBack(); // no hand me downs please.
if (parser != null) {
this.insideModuleInfo = parser.isParsingModuleDeclaration();
}
@@ -6320,6 +6384,16 @@ int disambiguatedRestrictedIdentifiersealed(int restrictedIdentifierToken) {
return disambiguatesRestrictedIdentifierWithLookAhead(this::mayBeAtASealedRestricedIdentifier,
restrictedIdentifierToken, Goal.RestrictedIdentifierSealedGoal);
}
+int disambiguatedRestrictedIdentifierWhen(int restrictedIdentifierToken) {
+ // and here's the kludge
+ if (restrictedIdentifierToken != TokenNameRestrictedIdentifierWhen)
+ return restrictedIdentifierToken;
+ if (!JavaFeature.PATTERN_MATCHING_IN_SWITCH.isSupported(this.complianceLevel, this.previewEnabled))
+ return TokenNameIdentifier;
+
+ return disambiguatesRestrictedIdentifierWithLookAhead(this::mayBeAtGuard,
+ restrictedIdentifierToken, Goal.RestrictedIdentifierWhenGoal);
+}
int disambiguatedRestrictedIdentifierYield(int restrictedIdentifierToken) {
// and here's the kludge
if (restrictedIdentifierToken != TokenNameRestrictedIdentifierYield)
@@ -6452,7 +6526,6 @@ protected int disambiguateArrowWithCaseExpr(Scanner scanner, int retToken) {
* Assumption: mayBeAtCasePattern(token) is true before calling this method.
*/
int disambiguateCasePattern(int token, Scanner scanner) {
- assert mayBeAtCasePattern(token);
int delta = token == TokenNamecase ? 4 : 0; // 4 for case.
final VanguardParser parser = getNewVanguardParser();
parser.scanner.resetTo(parser.scanner.currentPosition + delta, parser.scanner.eofPosition);
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
index ce24babd0..0d6239463 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java
@@ -41,7 +41,7 @@ public interface TerminalTokens {
TokenNameSingleQuoteStringLiteral = 1004;
// BEGIN_AUTOGENERATED_REGION
- int TokenNameIdentifier = 14,
+ int TokenNameIdentifier = 13,
TokenNameabstract = 56,
TokenNameassert = 88,
TokenNameboolean = 116,
@@ -52,7 +52,7 @@ public interface TerminalTokens {
TokenNamechar = 119,
TokenNameclass = 75,
TokenNamecontinue = 90,
- TokenNameconst = 152,
+ TokenNameconst = 153,
TokenNamedefault = 82,
TokenNamedo = 91,
TokenNamedouble = 120,
@@ -64,9 +64,9 @@ public interface TerminalTokens {
TokenNamefinally = 129,
TokenNamefloat = 121,
TokenNamefor = 92,
- TokenNamegoto = 153,
+ TokenNamegoto = 154,
TokenNameif = 93,
- TokenNameimplements = 149,
+ TokenNameimplements = 150,
TokenNameimport = 122,
TokenNameinstanceof = 18,
TokenNameint = 123,
@@ -86,12 +86,12 @@ public interface TerminalTokens {
TokenNamestrictfp = 63,
TokenNamesuper = 35,
TokenNameswitch = 67,
- TokenNamesynchronized = 53,
+ TokenNamesynchronized = 44,
TokenNamethis = 36,
TokenNamethrow = 85,
TokenNamethrows = 126,
TokenNametransient = 64,
- TokenNametrue = 44,
+ TokenNametrue = 45,
TokenNametry = 95,
TokenNamevoid = 127,
TokenNamevolatile = 65,
@@ -102,17 +102,17 @@ public interface TerminalTokens {
TokenNametransitive = 141,
TokenNameexports = 135,
TokenNameopens = 136,
- TokenNameto = 150,
+ TokenNameto = 151,
TokenNameuses = 137,
TokenNameprovides = 138,
TokenNamewith = 101,
TokenNameas = 142,
TokenNamebase = 33,
TokenNamecallin = 66,
- TokenNameplayedBy = 151,
+ TokenNameplayedBy = 152,
TokenNameprecedence = 102,
TokenNameteam = 54,
- TokenNametsuper = 38,
+ TokenNametsuper = 39,
TokenNamewhen = 98,
TokenNamewithin = 96,
TokenNamereplace = 143,
@@ -120,21 +120,21 @@ public interface TerminalTokens {
TokenNamebefore = 144,
TokenNameget = 145,
TokenNameset = 146,
- TokenNameIntegerLiteral = 45,
- TokenNameLongLiteral = 46,
- TokenNameFloatingPointLiteral = 47,
- TokenNameDoubleLiteral = 48,
- TokenNameCharacterLiteral = 49,
- TokenNameStringLiteral = 50,
- TokenNameTextBlock = 51,
+ TokenNameIntegerLiteral = 46,
+ TokenNameLongLiteral = 47,
+ TokenNameFloatingPointLiteral = 48,
+ TokenNameDoubleLiteral = 49,
+ TokenNameCharacterLiteral = 50,
+ TokenNameStringLiteral = 51,
+ TokenNameTextBlock = 52,
TokenNamePLUS_PLUS = 2,
TokenNameMINUS_MINUS = 3,
TokenNameEQUAL_EQUAL = 21,
TokenNameLESS_EQUAL = 15,
TokenNameGREATER_EQUAL = 16,
TokenNameNOT_EQUAL = 22,
- TokenNameLEFT_SHIFT = 19,
- TokenNameRIGHT_SHIFT = 13,
+ TokenNameLEFT_SHIFT = 20,
+ TokenNameRIGHT_SHIFT = 14,
TokenNameUNSIGNED_RIGHT_SHIFT = 17,
TokenNamePLUS_EQUAL = 103,
TokenNameMINUS_EQUAL = 104,
@@ -148,7 +148,7 @@ public interface TerminalTokens {
TokenNameRIGHT_SHIFT_EQUAL = 112,
TokenNameUNSIGNED_RIGHT_SHIFT_EQUAL = 113,
TokenNameOR_OR = 31,
- TokenNameAND_AND = 29,
+ TokenNameAND_AND = 30,
TokenNamePLUS = 4,
TokenNameMINUS = 5,
TokenNameNOT = 70,
@@ -161,23 +161,23 @@ public interface TerminalTokens {
TokenNameDIVIDE = 11,
TokenNameGREATER = 12,
TokenNameLESS = 8,
- TokenNameLPAREN = 20,
+ TokenNameLPAREN = 19,
TokenNameRPAREN = 24,
TokenNameLBRACE = 41,
TokenNameRBRACE = 34,
TokenNameLBRACKET = 6,
TokenNameRBRACKET = 74,
TokenNameSEMICOLON = 25,
- TokenNameQUESTION = 30,
+ TokenNameQUESTION = 29,
TokenNameCOLON = 68,
TokenNameCOMMA = 32,
TokenNameDOT = 1,
TokenNameEQUAL = 83,
- TokenNameAT = 39,
+ TokenNameAT = 38,
TokenNameELLIPSIS = 132,
TokenNameARROW = 114,
TokenNameCOLON_COLON = 7,
- TokenNameBeginLambda = 52,
+ TokenNameBeginLambda = 53,
TokenNameBeginIntersectionCast = 72,
TokenNameBeginTypeArguments = 84,
TokenNameElidedSemicolonAndRightBrace = 76,
@@ -189,10 +189,11 @@ public interface TerminalTokens {
TokenNameRestrictedIdentifiersealed = 55,
TokenNameRestrictedIdentifierpermits = 140,
TokenNameBeginCaseElement = 148,
+ TokenNameRestrictedIdentifierWhen = 149,
TokenNameATOT = 128,
TokenNameBINDIN = 81,
TokenNameCALLOUT_OVERRIDE = 97,
TokenNameBINDOUT = 73,
TokenNameEOF = 69,
- TokenNameERROR = 154;
+ TokenNameERROR = 155;
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
index 516f54524..5b4090832 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java
@@ -465,9 +465,9 @@ public class DiagnoseParser implements ParserBasicInformation, TerminalTokens, C
//{ObjectTeams: WATCHOUT: needs to be updated with each new grammar!!!!
private void setScannerState(int act) {
switch(act) {
- case 250: this.lexStream.forceBaseIsIdentifier(); break; // ForceBaseIsIdentifier
- case 251: this.lexStream.restoreBaseKeyword(); break; // RestoreBaseKeyword
- case 346: this.parser.scanner._insideParameterMapping = true; break; // NestedParamMappings
+ case 251: this.lexStream.forceBaseIsIdentifier(); break; // ForceBaseIsIdentifier
+ case 252: this.lexStream.restoreBaseKeyword(); break; // RestoreBaseKeyword
+ case 347: this.parser.scanner._insideParameterMapping = true; break; // NestedParamMappings
}
}
//SH}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
index bb25ad861..055403965 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc
index 574024d99..abefbd0ee 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc
index 9e4636821..ea8854bb2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
index 6cb6f599f..01316a8c6 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
index aa20ceaaf..3583f2339 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
index fc813e5f3..2c46b2caa 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
index a1c68d98c..51c444ce1 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
index 5e6367210..5b9ff4ae7 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
index c6f570749..caa13e824 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
index 26fd54c37..2e26137ac 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
index 003d1455f..7b030665d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
index f4f619be5..e4a8e43fe 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
index 339242089..7e8170694 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
index 38162e457..d00ca4a69 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
index 82e877f78..4f8cfe24d 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
index bb1712405..9a7e3a7ae 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
index 2a307e5dd..0c5e27885 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
index c182ba52e..09e0974bb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
index 0e7346d0b..21d71806b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
index 57e7fd2ae..676afb356 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
index 3f3b6ad9b..e6c5a4b5b 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
index a15c000c0..f0a3acf9f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
index 7e99bd764..d826a8bbd 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
index 4af68f8bd..8c1935d8f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc
Binary files differ
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props
index a6e3d8b58..0f78c92cf 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props
@@ -81,6 +81,7 @@ CalloutParameterMappingList=EmptyParameterMappings
CalloutParameterMappings=CalloutParameterMappings
CalloutParameterMappingsopt=EmptyParameterMappings
CaseLabelElement=CaseLabelElement
+CaseLabelElementPattern=CaseLabelElementPattern
CaseLabelElements=CaseLabelElements
CastExpression=CastExpression
CastNameAndBounds=CastNameAndBounds
@@ -194,7 +195,7 @@ FormalParameterListopt=FormalParameterList
GenericMethodDeclaration=GenericMethodDeclaration
GenericType=GenericType
Goal=Goal
-GuardedPattern=GuardedPattern
+Guard=Guard
Header1=Header1
Header2=Header2
Header=Header
@@ -215,8 +216,7 @@ InsideCastExpressionWithQualifiedGenerics=InsideCastExpression
InstanceofClassic=InstanceofClassic
InstanceofExpression=Expression
InstanceofExpression_NotName=Expression
-InstanceofPrimaryParenPattern=InstanceofPrimaryParenPattern
-InstanceofPrimaryTypePattern=InstanceofPrimaryTypePattern
+InstanceofPattern=InstanceofPattern
InstanceofRHS=Expression
IntegralType=IntegralType
InterfaceBody=InterfaceBody
@@ -313,7 +313,6 @@ PredicateBody=PredicateBody
PredicateHeader=PredicateHeader
Primary=Expression
PrimaryNoNewArray=Expression
-PrimaryPattern=PrimaryPattern
PrimitiveType=PrimitiveType
PushLPAREN=(
PushLeftBrace=PushLeftBrace
@@ -332,6 +331,8 @@ RecordBodyDeclarationopt=RecordBodyDeclarationopt
RecordBodyDeclarations=RecordBodyDeclarations
RecordComponent=RecordComponent
RecordComponentHeaderRightParen=)
+RecordComponentPatternList=RecordComponentPatternList
+RecordComponentPatternsopt=RecordComponentsopt
RecordComponents=RecordComponents
RecordComponentsopt=RecordComponentsopt
RecordDeclaration=RecordDeclaration
@@ -339,6 +340,8 @@ RecordHeader=RecordHeader
RecordHeaderName1=RecordHeaderName
RecordHeaderName=RecordHeaderName
RecordHeaderPart=RecordHeaderPart
+RecordPattern=RecordPattern
+RecordStructurePattern=RecordStructurePattern
RecoveryBindingHeader=MethodBindingHeader
RecoveryCallinBindingLeftLong=CallinBindingLeft
RecoveryCallinHeader=CallinBindingLong
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 e165ec429..de0e50803 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
@@ -1042,9 +1042,10 @@ public static int getProblemCategory(int severity, int problemID) {
break categorizeOnIrritant;
}
}
- // categorize fatal problems per ID
+ // categorize fatal / non-configurable problems per ID
switch (problemID) {
case IProblem.IsClassPathCorrect :
+ case IProblem.IsClassPathCorrectWithReferencingType :
case IProblem.CorruptedSignature :
case IProblem.UndefinedModuleAddReads :
case IProblem.MissingNullAnnotationImplicitlyUsed :
@@ -1056,6 +1057,8 @@ public static int getProblemCategory(int severity, int problemID) {
// SH}
case IProblem.ProblemNotAnalysed :
return CategorizedProblem.CAT_UNNECESSARY_CODE;
+ case IProblem.NonNullArrayContentNotInitialized :
+ return CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM;
default :
if ((problemID & IProblem.Syntax) != 0)
return CategorizedProblem.CAT_SYNTAX;
@@ -2406,14 +2409,6 @@ public void illegalRedeclarationOfPatternVar(LocalVariableBinding local, ASTNode
nodeSourceStart(local, location),
nodeSourceEnd(local, location));
}
-public void patternCannotBeSubtypeOfExpression(LocalVariableBinding local, ASTNode location) {
- this.handle(
- IProblem.PatternSubtypeOfExpression,
- NoArgument,
- NoArgument,
- nodeSourceStart(local, location),
- nodeSourceEnd(local, location));
-}
public void duplicateMethodInType(AbstractMethodDeclaration methodDecl, boolean equalParameters, int severity) {
MethodBinding method = methodDecl.binding;
if (equalParameters) {
@@ -5734,7 +5729,9 @@ public void discouragedValueBasedTypeToSynchronize(Expression expression, TypeBi
expression.sourceStart,
expression.sourceEnd);
}
-public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl, Object location, boolean implicitAnnotationUse) {
+public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclaration compUnitDecl,
+ Object location, boolean implicitAnnotationUse, ReferenceBinding referencingType)
+{
// ProblemReporter is not designed to be reentrant. Just in case, we discovered a build path problem while we are already
// in the midst of reporting some other problem, save and restore reference context thereby mimicking a stack.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=442755.
@@ -5754,8 +5751,19 @@ public void isClassPathCorrect(char[][] wellKnownTypeName, CompilationUnitDeclar
}
}
try {
+ int pId = IProblem.IsClassPathCorrect;
+ if (implicitAnnotationUse) {
+ pId = IProblem.MissingNullAnnotationImplicitlyUsed;
+ } else {
+ if (referencingType != null) {
+ // avoid readableName() which might cause reentrant "isClassPathCorrect" when resolving type variables
+ char[] fullyQualifiedtypeName = CharOperation.concatWith(referencingType.fPackage.compoundName, referencingType.qualifiedSourceName(), '.');
+ arguments = new String[] { arguments[0], new String(fullyQualifiedtypeName) };
+ pId = IProblem.IsClassPathCorrectWithReferencingType;
+ }
+ }
this.handle(
- implicitAnnotationUse ? IProblem.MissingNullAnnotationImplicitlyUsed : IProblem.IsClassPathCorrect,
+ pId,
arguments,
arguments,
start,
@@ -5773,6 +5781,7 @@ private boolean isRestrictedIdentifier(int token) {
case TerminalTokens.TokenNameRestrictedIdentifierrecord:
case TerminalTokens.TokenNameRestrictedIdentifiersealed:
case TerminalTokens.TokenNameRestrictedIdentifierpermits:
+ case TerminalTokens.TokenNameRestrictedIdentifierWhen:
return true;
default: return false;
}
@@ -5835,6 +5844,7 @@ private boolean isKeyword(int token) {
case TerminalTokens.TokenNameRestrictedIdentifierrecord:
case TerminalTokens.TokenNameRestrictedIdentifiersealed:
case TerminalTokens.TokenNameRestrictedIdentifierpermits:
+ case TerminalTokens.TokenNameRestrictedIdentifierWhen:
// making explicit - not a (restricted) keyword but restricted identifier.
//$FALL-THROUGH$
default:
@@ -15330,6 +15340,17 @@ public void arrayReferencePotentialNullReference(ArrayReference arrayReference)
this.handle(IProblem.ArrayReferencePotentialNullReference, NoArgument, NoArgument, arrayReference.sourceStart, arrayReference.sourceEnd);
}
+
+public void nonNullArrayContentNotInitialized(Expression dimension, LookupEnvironment lookupEnvironment, TypeBinding elementType) {
+ this.handle(
+ IProblem.NonNullArrayContentNotInitialized,
+ new String[] {new String(elementType.nullAnnotatedReadableName(lookupEnvironment.globalOptions, false))},
+ new String[] {new String(elementType.nullAnnotatedReadableName(lookupEnvironment.globalOptions, true))},
+ ProblemSeverities.Info,
+ dimension.sourceStart-1, // optimistically try to include '[' and ']'
+ dimension.sourceEnd+1);
+}
+
public void nullityMismatchingTypeAnnotation(Expression expression, TypeBinding providedType, TypeBinding requiredType, NullAnnotationMatching status)
{
if (providedType == requiredType) return; //$IDENTITY-COMPARISON$
@@ -16775,5 +16796,36 @@ public void unexpectedTypeinSwitchPattern(TypeBinding type, ASTNode element) {
element.sourceStart,
element.sourceEnd);
}
-
+public void unexpectedTypeinRecordPattern(TypeBinding type, ASTNode element) {
+ this.handle(
+ IProblem.UnexpectedTypeinRecordPattern,
+ new String[] {new String(type.readableName())},
+ new String[] {new String(type.shortReadableName())},
+ element.sourceStart,
+ element.sourceEnd);
+}
+public void recordPatternSignatureMismatch(TypeBinding type, ASTNode element) {
+ this.handle(
+ IProblem.RecordPatternMismatch,
+ new String[] {new String(type.readableName())},
+ new String[] {new String(type.shortReadableName())},
+ element.sourceStart,
+ element.sourceEnd);
+}
+public void incompatiblePatternType(ASTNode element, TypeBinding type, TypeBinding expected) {
+ this.handle(
+ IProblem.PatternTypeMismatch,
+ new String[] {new String(type.readableName()), new String(expected.readableName())},
+ new String[] {new String(type.shortReadableName()), new String(expected.readableName())},
+ element.sourceStart,
+ element.sourceEnd);
+}
+public void rawTypeInRecordPattern(TypeBinding type, ASTNode element) {
+ this.handle(
+ IProblem.RawTypeInRecordPattern,
+ new String[] {new String(type.readableName())},
+ new String[] {new String(type.shortReadableName())},
+ element.sourceStart,
+ element.sourceEnd);
+}
}
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 8a4c8b368..c3052c66c 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
@@ -320,6 +320,7 @@
322 = The type {1} collides with a package
323 = The type {1} is already defined
324 = The type {0} cannot be resolved. It is indirectly referenced from required .class files
+# see also 347 below
325 = The public type {1} must be defined in its own file
###[obsolete] 326 = A package must be specified in {0} or a default package created
327 = The hierarchy of the type {0} is inconsistent
@@ -349,6 +350,8 @@
345 = The field {0} can be either final or volatile, not both
346 = The field {0} cannot be declared static in a non-static inner type, unless initialized with a constant expression
+347 = The type {0} cannot be resolved. It is indirectly referenced from required type {1}
+
###[obsolete] 350 = {2} cannot be resolved (or is not a valid type) for the field {1}.{0}
###[obsolete] 351 = The type {2} is not visible for the field {1}.{0}
###[obsolete] 352 = The type {2} is ambiguous for the field {1}.{0}
@@ -862,6 +865,7 @@
982 = Annotation type ''{0}'' cannot be found on the build path, which is implicitly needed for null analysis
983 = Unsafe null type conversion (type annotations): The value of type ''{1}'' is made accessible using the less-annotated type ''{0}''
984 = Unsafe null type conversion (type annotations): The value of type ''{1}'' is made accessible using the less-annotated type ''{0}'', corresponding supertype is ''{2}''
+985 = This array dimension with declared element type {0} will be initialized with ''null'' entries
# Java 8
1001 = Syntax error, modifiers and annotations are not allowed for the lambda parameter {0} as its type is elided
@@ -1135,12 +1139,18 @@
1904 = A switch label may not have both a pattern case label element and a default case label element
1905 = A null case label and patterns can co-exist only if the pattern is a type pattern
1906 = This case label is dominated by one of the preceding case label
-1907 = Switch case cannot have both a total pattern and default label
+1907 = Switch case cannot have both unconditional pattern and default label
1908 = An enhanced switch statement should be exhaustive; a default label expected
-1909 = The switch statement cannot have more than one total pattern
+1909 = The switch statement cannot have more than one unconditional pattern
1910 = Unnecessary 'null' pattern, the switch selector expression cannot be null
1911 = Unexpected type {0}, expected class or array type
+# Record patterns = Java 19 JEP 405 preview
+1912 = Only record types are permitted in a record pattern
+1913 = Record pattern should match the signature of the record declaration
+1914 = Pattern of type {0} is not compatible with type {1}
+1915 = Raw types are not allowed in record patterns
+
### ELABORATIONS
## Access restrictions
78592 = The type ''{1}'' is not API (restriction on classpath entry ''{0}'')
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java
index ef5eeaf2b..653fea521 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java
@@ -123,6 +123,7 @@ public final class Messages {
public static String records;
public static String sealed_types;
public static String pattern_matching_switch;
+ public static String record_patterns;
static {
initializeMessages(BUNDLE_NAME, Messages.class);
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 85e108853..f6782c963 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
@@ -406,11 +406,27 @@ public final class AST {
* up to and including Java SE 18(aka JDK 18).
* </p>
*
+ * @deprecated
* @since 3.30
*/
public static final int JLS18 = 18;
/**
+ * Constant for indicating the AST API that handles JLS17.
+ * <p>
+ * This API is capable of handling all constructs in the
+ * Java language as described in the Java Language
+ * Specification, Java SE 18 Edition (JLS18).
+ * JLS18 is a superset of all earlier versions of the
+ * Java language, and the JLS18 API can be used to manipulate
+ * programs written in all versions of the Java language
+ * up to and including Java SE 18(aka JDK 18).
+ * </p>
+ *
+ * @since 3.32
+ */
+ public static final int JLS19 = 19;
+ /**
* Internal synonym for {@link #JLS15}. Use to alleviate
* deprecation warnings once JLS15 is deprecated
*/
@@ -431,17 +447,22 @@ public final class AST {
*/
static final int JLS18_INTERNAL = JLS18;
/**
+ * Internal synonym for {@link #JLS19}. Use to alleviate
+ * deprecation warnings once JLS19 is deprecated
+ */
+ static final int JLS19_INTERNAL = JLS19;
+ /**
* Internal property for latest supported JLS level
* This provides the latest JLS level.
*/
- private static final int JLS_INTERNAL_Latest = JLS18;
+ private static final int JLS_INTERNAL_Latest = JLS19;
/**
* @since 3.26
* This provides the latest JLS level.
* @deprecated use {@link #getJLSLatest()}
*/
- public static final int JLS_Latest = JLS18;
+ public static final int JLS_Latest = JLS_INTERNAL_Latest;
/*
* Must not collide with a value for ICompilationUnit constants
@@ -1177,6 +1198,7 @@ public final class AST {
t.put(JavaCore.VERSION_16, ClassFileConstants.JDK16);
t.put(JavaCore.VERSION_17, ClassFileConstants.JDK17);
t.put(JavaCore.VERSION_18, ClassFileConstants.JDK18);
+ t.put(JavaCore.VERSION_19, ClassFileConstants.JDK19);
return Collections.unmodifiableMap(t);
}
private static Map<String, Integer> getApiLevelMapTable() {
@@ -1199,6 +1221,7 @@ public final class AST {
t.put(JavaCore.VERSION_16, JLS16_INTERNAL);
t.put(JavaCore.VERSION_17, JLS17_INTERNAL);
t.put(JavaCore.VERSION_18, JLS18_INTERNAL);
+ t.put(JavaCore.VERSION_19, JLS19_INTERNAL);
return Collections.unmodifiableMap(t);
}
/**
@@ -2943,6 +2966,18 @@ public final class AST {
RecordDeclaration result = new RecordDeclaration(this);
return result;
}
+
+ /**
+ * Creates and returns a new unparented type pattern node with an
+ * unspecified pattern variable.
+ *
+ * @return a new unparented type pattern node
+ * @since 3.32
+ */
+ public RecordPattern newRecordPattern() {
+ RecordPattern result = new RecordPattern(this);
+ return result;
+ }
/**
* Creates and returns a new unparented requires directive
* node for an unspecified, but legal, name;
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
index de08850cd..cc28205ec 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java
@@ -2471,8 +2471,33 @@ class ASTConverter {
int startPosition = pattern.sourceStart;
int sourceEnd = pattern.sourceEnd;
guardedPattern.setSourceRange(startPosition, sourceEnd - startPosition + 1);
+ guardedPattern.setRestrictedIdentifierStartPosition(pattern.restrictedIdentifierStart);
return guardedPattern;
}
+ // TODO: Implement this. What we have here is just a dummy implementation
+ public Pattern convert(org.eclipse.jdt.internal.compiler.ast.RecordPattern pattern) {
+ RecordPattern recordPattern = new RecordPattern(this.ast);
+ if (this.resolveBindings) {
+ recordNodes(recordPattern, pattern);
+ }
+ int startPosition = pattern.sourceStart;
+ int sourceEnd= pattern.sourceEnd;
+ recordPattern.setSourceRange(startPosition, sourceEnd - startPosition + 1);
+ if (pattern.local != null) {
+ recordPattern.setPatternType(convertType(pattern.local.type));
+ SimpleName patternName = new SimpleName(this.ast);
+ patternName.internalSetIdentifier(new String(pattern.local.name));
+ patternName.setSourceRange(pattern.local.nameSourceStart(), pattern.local.nameSourceEnd() - pattern.local.nameSourceStart() + 1);
+ recordPattern.setPatternName(patternName);
+ } else if (pattern.type != null) {
+ recordPattern.setPatternType(convertType(pattern.type));
+ }
+ for (org.eclipse.jdt.internal.compiler.ast.Pattern nestedPattern : pattern.patterns ) {
+ recordPattern.patterns().add(convert(nestedPattern));
+
+ }
+ return recordPattern;
+ }
public IfStatement convert(org.eclipse.jdt.internal.compiler.ast.IfStatement statement) {
IfStatement ifStatement = new IfStatement(this.ast);
@@ -3062,6 +3087,9 @@ class ASTConverter {
if (!DOMASTUtil.isPatternSupported(this.ast)) {
return createFakeNullPattern(pattern);
}
+ if (pattern instanceof org.eclipse.jdt.internal.compiler.ast.RecordPattern) {
+ return convert((org.eclipse.jdt.internal.compiler.ast.RecordPattern) pattern);
+ }
if (pattern instanceof org.eclipse.jdt.internal.compiler.ast.GuardedPattern) {
return convert((org.eclipse.jdt.internal.compiler.ast.GuardedPattern) pattern);
}
@@ -3069,6 +3097,7 @@ class ASTConverter {
return convert((org.eclipse.jdt.internal.compiler.ast.TypePattern) pattern);
}
+
return null;
}
@@ -6198,6 +6227,9 @@ class ASTConverter {
case TerminalTokens.TokenNamenon_sealed:
modifier = createModifier(Modifier.ModifierKeyword.NON_SEALED_KEYWORD);
break;
+ case TerminalTokens.TokenNameRestrictedIdentifierWhen:
+ modifier = createModifier(Modifier.ModifierKeyword.WHEN_KEYWORD);
+ break;
case TerminalTokens.TokenNameAT :
// we have an annotation
if (annotations != null && indexInAnnotations < annotations.length) {
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 11bb907fb..e9b3e1eb7 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
@@ -7,6 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Fraunhofer FIRST - extended API and implementation
@@ -2151,6 +2152,31 @@ public class ASTMatcher {
* @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.32
+ */
+ public boolean match(RecordPattern node, Object other) {
+ if (!(other instanceof RecordPattern)) {
+ return false;
+ }
+ RecordPattern o = (RecordPattern) other;
+ return safeSubtreeMatch(node.getPatternType(), o.getPatternType())
+ && safeSubtreeMatch(node.getPatternName(), o.getPatternName())
+ && safeSubtreeListMatch(node.patterns(), o.patterns());
+ }
+
+ /**
+ * Returns whether the given node and the other object match.
+ * <p>
+ * The default implementation provided by this class tests whether the
+ * other object is a node of the same type with structurally isomorphic
+ * child subtrees. Subclasses may override this method as needed.
+ * </p>
+ *
+ * @param node the node
+ * @param other the other object, or <code>null</code>
+ * @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.1
*/
public boolean match(QualifiedType node, Object other) {
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 1aa1f2a7d..7cb06889d 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
@@ -1060,9 +1060,16 @@ public abstract class ASTNode {
*/
public static final int JAVADOC_TEXT_ELEMENT = 112;
+ /**
+ * Node type constant indicating a node of type
+ * <code>RecordPattern</code>.
+ * @see RecordPattern
+ * @since 3.32
+ */
+ public static final int RECORD_PATTERN = 113;
//{ObjectTeams: required OT specific node type constants added
- private static final int LAST_JDT = 112;
+ private static final int LAST_JDT = 113;
/**
* Node type constant indicating a node of type
@@ -1322,6 +1329,8 @@ public abstract class ASTNode {
return QualifiedType.class;
case RECORD_DECLARATION :
return RecordDeclaration.class;
+ case RECORD_PATTERN :
+ return RecordPattern.class;
case REQUIRES_DIRECTIVE :
return RequiresDirective.class;
case RETURN_STATEMENT :
@@ -2610,7 +2619,22 @@ public abstract class ASTNode {
*/
final void supportedOnlyIn18() {
if (this.ast.apiLevel != AST.JLS18_INTERNAL) {
- throw new UnsupportedOperationException("Operation only supported in JLS17 AST"); //$NON-NLS-1$
+ throw new UnsupportedOperationException("Operation only supported in JLS18 AST"); //$NON-NLS-1$
+ }
+ }
+ /**
+ * Checks that this AST operation is only used when
+ * building JLS19 level ASTs.
+ * <p>
+ * Use this method to prevent access to new properties available only in JLS19.
+ * </p>
+ *
+ * @exception UnsupportedOperationException if this operation is not used in JLS19
+ * @since 3.30
+ */
+ final void supportedOnlyIn19() {
+ if (this.ast.apiLevel != AST.JLS19_INTERNAL) {
+ throw new UnsupportedOperationException("Operation only supported in JLS19 AST"); //$NON-NLS-1$
}
}
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 2d9265228..d633d890c 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
@@ -1473,6 +1473,23 @@ public abstract class ASTVisitor {
* Visits the given type-specific AST node.
* <p>
* The default implementation does nothing and return true.
+ * Subclasses may reimplement.
+ * </p>
+ *
+ * @param node the node to visit
+ * @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.32
+ */
+ public boolean visit(RecordPattern node) {
+ return true;
+ }
+
+ /**
+ * Visits the given type-specific AST node.
+ * <p>
+ * The default implementation does nothing and return true.
* Subclasses may re-implement.
* </p>
*
@@ -2596,7 +2613,7 @@ public abstract class ASTVisitor {
* </p>
*
* @param node the node to visit
- * @since 3.31
+ * @since 3.32
*/
public void endVisit(JavaDocTextElement node) {
// default implementation: do nothing
@@ -2996,6 +3013,19 @@ public abstract class ASTVisitor {
// default implementation: do nothing
}
+ /**
+ * End of visit the given type-specific AST node.
+ * <p>
+ * The default implementation does nothing. Subclasses may re implement.
+ * </p>
+ *
+ * @param node the node to visit
+ * @since 3.31
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void endVisit(RecordPattern node) {
+ // default implementation: do nothing
+ }
/**
* End of visit the given type-specific AST node.
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
index 0abd4c10e..de7271eff 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java
@@ -7,7 +7,6 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -326,6 +325,10 @@ class DefaultASTVisitor extends ASTVisitor {
endVisitNode(node);
}
@Override
+ public void endVisit(RecordPattern node) {
+ endVisitNode(node);
+ }
+ @Override
public void endVisit(ReturnStatement node) {
endVisitNode(node);
}
@@ -766,6 +769,10 @@ class DefaultASTVisitor extends ASTVisitor {
return visitNode(node);
}
@Override
+ public boolean visit(RecordPattern node) {
+ return visitNode(node);
+ }
+ @Override
public boolean visit(ReturnStatement node) {
return visitNode(node);
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java
index 18373d993..8bc21c625 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java
@@ -23,7 +23,7 @@ import org.eclipse.jdt.internal.core.dom.util.DOMASTUtil;
*
* <pre>
* GuardedPattern:
- * Pattern && Expression
+ * Pattern when Expression
* </pre>
*
* @since 3.27
@@ -36,7 +36,7 @@ public class GuardedPattern extends Pattern{
GuardedPattern(AST ast) {
super(ast);
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
}
@@ -51,6 +51,11 @@ public class GuardedPattern extends Pattern{
public static final ChildPropertyDescriptor EXPRESSION_PROPERTY =
new ChildPropertyDescriptor(GuardedPattern.class, "expression", Expression.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$);
+ /**
+ * A character index into the original restricted identifier source string, or <code>-1</code> if no restricted
+ * identifier source position information is available for this node; <code>-1</code> by default.
+ */
+ private int restrictedIdentifierStartPosition = -1;
/**
* A list of property descriptors (element type:
@@ -126,6 +131,7 @@ public class GuardedPattern extends Pattern{
result.setSourceRange(getStartPosition(), getLength());
result.setPattern((Pattern) getPattern().clone(target));
result.setExpression((Expression) getExpression().clone(target));
+ result.setRestrictedIdentifierStartPosition(this.restrictedIdentifierStartPosition);
return result;
}
@@ -154,11 +160,6 @@ public class GuardedPattern extends Pattern{
+ (this.conditonalExpression == null ? 0 : getExpression().treeSize());
}
- @Override
- public List<SingleVariableDeclaration> patternVariables() {
- return null;
- }
-
/**
* Returns a list of structural property descriptors for this node type.
* Clients must not modify the result.
@@ -198,7 +199,7 @@ public class GuardedPattern extends Pattern{
* @return the expression node, or <code>null</code> if there is none
*/
public Expression getExpression() {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
return this.conditonalExpression;
}
@@ -213,7 +214,7 @@ public class GuardedPattern extends Pattern{
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
*/
public Pattern getPattern() {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
return this.pattern;
}
@@ -232,7 +233,7 @@ public class GuardedPattern extends Pattern{
* </ul>
*/
public void setExpression(Expression expression) {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
ASTNode oldChild = this.conditonalExpression;
preReplaceChild(oldChild, expression, EXPRESSION_PROPERTY);
@@ -248,7 +249,7 @@ public class GuardedPattern extends Pattern{
* @exception UnsupportedOperationException if this operation is used without previewEnabled
*/
public void setPattern(Pattern pattern) {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
ASTNode oldChild = this.pattern;
preReplaceChild(oldChild, pattern, PATTERN_PROPERTY);
@@ -256,4 +257,30 @@ public class GuardedPattern extends Pattern{
postReplaceChild(oldChild, pattern, PATTERN_PROPERTY);
}
+ /**
+ * A character index into the original restricted identifier source string, or <code>-1</code> if no restricted
+ * identifier source position information is available for this node; <code>-1</code> by default.
+ * @noreference
+ * since 3.30
+ */
+ protected void setRestrictedIdentifierStartPosition(int restrictedIdentifierStartPosition) {
+ if (restrictedIdentifierStartPosition < 0) {
+ throw new IllegalArgumentException();
+ }
+ // restrictedIdentifierStartPosition is not considered a structural property
+ // but we protect it nevertheless
+ checkModifiable();
+ this.restrictedIdentifierStartPosition = restrictedIdentifierStartPosition;
+ }
+
+ /**
+ * A character index into the original restricted identifier source string, or <code>-1</code> if no restricted
+ * identifier source position information is available for this node; <code>-1</code> by default.
+ * @noreference
+ * @since 3.30
+ */
+ public int getRestrictedIdentifierStartPosition() {
+ return this.restrictedIdentifierStartPosition;
+ }
+
}
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 be9795c4f..09ba8cf6e 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2020 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -136,7 +136,11 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
* @since 3.24
*/
public static final ModifierKeyword SEALED_KEYWORD = new ModifierKeyword("sealed", SEALED);//$NON-NLS-1$
-
+ /**
+ * @since 3.32
+ * @noreference preview feature
+ */
+ public static final ModifierKeyword WHEN_KEYWORD = new ModifierKeyword("when", WHEN);//$NON-NLS-1$
/**
* @since 3.24
*/
@@ -373,6 +377,13 @@ public final class Modifier extends ASTNode implements IExtendedModifier {
* @since 3.24
*/
public static final int NON_SEALED = 0x1000;
+ /**
+ * "when" modifier constant (bit mask).
+ * Applicable only to types.
+ * @since 3.32
+ * @noreference preview feature
+ */
+ public static final int WHEN = 0x2000;
/**
* "default" modifier constant (bit mask) (added in JLS8 API).
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullPattern.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullPattern.java
index 4b8f83e70..2beed6898 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullPattern.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullPattern.java
@@ -64,7 +64,7 @@ public class NullPattern extends Pattern {
*/
NullPattern(AST ast) {
super(ast);
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
}
@@ -106,10 +106,5 @@ public class NullPattern extends Pattern {
int treeSize() {
return memSize();
}
-
- @Override
- public List<SingleVariableDeclaration> patternVariables() {
- return null;
- }
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Pattern.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Pattern.java
index e1bd07464..a19f2bc3e 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Pattern.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Pattern.java
@@ -14,8 +14,6 @@
package org.eclipse.jdt.core.dom;
-import java.util.List;
-
/**
* Abstract base class of AST nodes that represent patterns.
* There are several kinds of patterns.
@@ -41,7 +39,7 @@ public abstract class Pattern extends Expression {
*/
Pattern(AST ast) {
super(ast);
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
}
@@ -57,16 +55,5 @@ public abstract class Pattern extends Expression {
return new ChildPropertyDescriptor(nodeClass, "pattern", Javadoc.class, MANDATORY, NO_CYCLE_RISK); //$NON-NLS-1$
}
- /**
- * Returns the list of pattern variables
- *
- * @return the list of pattern variables
- * (element type: {@link SingleVariableDeclaration})
- * @exception UnsupportedOperationException if this operation is not used for JLS18
- * @exception UnsupportedOperationException if this operation is not used with previewEnabled flag as true
- * @noreference This method is not intended to be referenced by clients.
- */
- public abstract List<SingleVariableDeclaration> patternVariables();
-
}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java
new file mode 100644
index 000000000..4e4a62602
--- /dev/null
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordPattern.java
@@ -0,0 +1,322 @@
+/*******************************************************************************
+ * Copyright (c) 2022 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.dom;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.internal.core.dom.util.DOMASTUtil;
+
+/**
+ * TypePattern pattern AST node type.
+ *
+ * <pre>
+ * RecordPattern:
+ * Pattern<Pattern<Patterns....>> Type SimpleName
+ * </pre>
+ *
+ * @since 3.31
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ * @noreference This class is not intended to be referenced by clients.
+ */
+@SuppressWarnings("rawtypes")
+public class RecordPattern extends Pattern {
+
+ /**
+ * The "patterns" structural property of this node type (child type: {@link Pattern}).
+ */
+ public static final ChildListPropertyDescriptor PATTERNS_PROPERTY =
+ new ChildListPropertyDescriptor(RecordPattern.class, "patterns", Pattern.class, CYCLE_RISK); //$NON-NLS-1$
+
+ /**
+ * The "patternType" structural property of this node type (child type: {@link Type}).
+ */
+ public static final ChildPropertyDescriptor PATTERN_TYPE_PROPERTY =
+ new ChildPropertyDescriptor(RecordPattern.class, "patternType", Type.class, MANDATORY, CYCLE_RISK); //$NON-NLS-1$
+
+ /**
+ * The "patternName" structural property of this node type (child type: {@link SimpleName}).
+ */
+ public static final ChildPropertyDescriptor PATTERN_NAME_PROPERTY =
+ new ChildPropertyDescriptor(RecordPattern.class, "patternName", SimpleName.class, OPTIONAL, CYCLE_RISK); //$NON-NLS-1$
+
+ /**
+ * A list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor}),
+ * or null if uninitialized.
+ */
+ private static final List PROPERTY_DESCRIPTORS;
+
+ static {
+ List properyList = new ArrayList(5);
+ createPropertyList(RecordPattern.class, properyList);
+ addProperty(PATTERN_TYPE_PROPERTY, properyList);
+ addProperty(PATTERNS_PROPERTY, properyList);
+ addProperty(PATTERN_NAME_PROPERTY, properyList);
+ PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
+ }
+
+ @Override
+ int getNodeType0() {
+ return ASTNode.RECORD_PATTERN;
+ }
+
+ RecordPattern(AST ast) {
+ super(ast);
+ supportedOnlyIn19();
+ unsupportedWithoutPreviewError();
+ }
+
+
+ /**
+ * The pattern name;
+ */
+ private SimpleName optionalPatternName = null;
+
+ /**
+ * The pattern type;
+ */
+ private Type patternType = null;
+
+ /**
+ * The patterns
+ * (element type: {@link Pattern}).
+ * Defaults to an empty list.
+ */
+ private ASTNode.NodeList patterns =
+ new ASTNode.NodeList(PATTERNS_PROPERTY);
+
+ /**
+ * Returns a list of structural property descriptors for this node type.
+ * Clients must not modify the result.
+ *
+ * @param apiLevel the API level; one of the
+ * <code>AST.JLS*</code> constants
+ * @return a list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor})
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public static List propertyDescriptors(int apiLevel) {
+ return null;
+ }
+
+ /**
+ * Returns a list of structural property descriptors for this node type.
+ * Clients must not modify the result.
+ *
+ * @param apiLevel the API level; one of the
+ * <code>AST.JLS*</code> constants
+ * @param previewEnabled the previewEnabled flag
+ * @return a list of property descriptors (element type:
+ * {@link StructuralPropertyDescriptor})
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public static List propertyDescriptors(int apiLevel, boolean previewEnabled) {
+ if (DOMASTUtil.isPatternSupported(apiLevel, previewEnabled)) {
+ return PROPERTY_DESCRIPTORS;
+ }
+ return null;
+ }
+
+ @Override
+ final List internalStructuralPropertiesForType(int apiLevel) {
+ return propertyDescriptors(apiLevel);
+ }
+
+ @Override
+ final List internalStructuralPropertiesForType(int apiLevel, boolean previewEnabled) {
+ return propertyDescriptors(apiLevel, previewEnabled);
+ }
+
+ @Override
+ final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) {
+ if (property == PATTERN_TYPE_PROPERTY ) {
+ if (get) {
+ return getPatternType();
+ } else {
+ setPatternType((Type) child);
+ return null;
+ }
+ } else if (property == PATTERN_NAME_PROPERTY ) {
+ if (get) {
+ return getPatternName();
+ } else {
+ setPatternName((SimpleName) child);
+ return null;
+ }
+ }
+ // allow default implementation to flag the error
+ return super.internalGetSetChildProperty(property, get, child);
+ }
+
+ @Override
+ final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
+ if (property == PATTERNS_PROPERTY) {
+ return patterns();
+ }
+ // allow default implementation to flag the error
+ return super.internalGetChildListProperty(property);
+ }
+
+ /**
+ * Sets the pattern name.
+ *
+ * @param patternName the right operand node
+ * @exception IllegalArgumentException if:
+ * <ul>
+ * <li>the node belongs to a different AST</li>
+ * <li>the node already has a parent</li>
+ * <li>a cycle in would be created</li>
+ * </ul>
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
+ * @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public void setPatternName(SimpleName patternName) {
+ supportedOnlyIn19();
+ unsupportedWithoutPreviewError();
+ if (patternName == null) {
+ throw new IllegalArgumentException();
+ }
+ ASTNode oldChild = this.optionalPatternName;
+ preReplaceChild(oldChild, patternName, PATTERN_NAME_PROPERTY);
+ this.optionalPatternName = patternName;
+ postReplaceChild(oldChild, patternName, PATTERN_NAME_PROPERTY);
+ }
+
+ /**
+ * Sets the pattern type.
+ *
+ * @param patternType the right operand node
+ * @exception IllegalArgumentException if:
+ * <ul>
+ * <li>the node belongs to a different AST</li>
+ * <li>the node already has a parent</li>
+ * <li>a cycle in would be created</li>
+ * </ul>
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
+ * @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public void setPatternType(Type patternType) {
+ supportedOnlyIn19();
+ unsupportedWithoutPreviewError();
+ if (patternType == null) {
+ throw new IllegalArgumentException();
+ }
+ ASTNode oldChild = this.patternType;
+ preReplaceChild(oldChild, patternType, PATTERN_TYPE_PROPERTY);
+ this.patternType = patternType;
+ postReplaceChild(oldChild, patternType, PATTERN_TYPE_PROPERTY);
+ }
+
+ /**
+ * Returns the pattern Name of Types Pattern.
+ *
+ * @return the pattern Name
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
+ * @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public SimpleName getPatternName() {
+ supportedOnlyIn19();
+ unsupportedWithoutPreviewError();
+ return this.optionalPatternName;
+ }
+
+ /**
+ * Returns the pattern type of Types Pattern.
+ *
+ * @return the pattern type
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
+ * @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ public Type getPatternType() {
+ supportedOnlyIn19();
+ unsupportedWithoutPreviewError();
+ if (this.patternType == null) {
+ // lazy init must be thread-safe for readers
+ synchronized (this) {
+ if (this.patternType == null) {
+ preLazyInit();
+ this.patternType= this.ast.newPrimitiveType(PrimitiveType.INT);
+ postLazyInit(this.patternType, PATTERN_TYPE_PROPERTY);
+ }
+ }
+ }
+ return this.patternType;
+ }
+
+ /**
+ * Returns the nested Pattern list.
+ *
+ * @return the live list of pattern nodes
+ * (element type: {@link Pattern})
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
+ * @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
+ * @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
+ */
+ @SuppressWarnings("unchecked")
+ public List<Pattern> patterns() {
+ supportedOnlyIn19();
+ unsupportedWithoutPreviewError();
+ return this.patterns;
+ }
+
+
+ @Override
+ boolean subtreeMatch0(ASTMatcher matcher, Object other) {
+ return matcher.match(this, other);
+ }
+
+ @Override
+ ASTNode clone0(AST target) {
+ RecordPattern result = new RecordPattern(target);
+ result.setSourceRange(getStartPosition(), getLength());
+ result.patterns().addAll(ASTNode.copySubtrees(target, patterns()));
+ result.setPatternType((Type) getPatternType().clone(target));
+ result.setPatternName((SimpleName) getPatternName().clone(target));
+ return result;
+ }
+
+ @Override
+ void accept0(ASTVisitor visitor) {
+ boolean visitChildren = visitor.visit(this);
+ if (visitChildren) {
+ // visit children in normal left to right reading order
+ acceptChildren(visitor, this.patterns);
+ acceptChild(visitor, getPatternType());
+ acceptChild(visitor, getPatternName());
+ }
+ visitor.endVisit(this);
+
+ }
+
+ @Override
+ int memSize() {
+ return BASE_NODE_SIZE + 2 * 4 ;
+ }
+
+ @Override
+ int treeSize() {
+ return
+ memSize()
+ + (this.patternType == null ? 0 : getPatternType().treeSize())
+ + (this.optionalPatternName == null ? 0 : getPatternName().treeSize())
+ + this.patterns.listSize();
+ }
+
+
+}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypePattern.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypePattern.java
index 135024e35..374c411c0 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypePattern.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypePattern.java
@@ -60,7 +60,7 @@ public class TypePattern extends Pattern {
TypePattern(AST ast) {
super(ast);
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
}
@@ -121,9 +121,8 @@ public class TypePattern extends Pattern {
return super.internalGetSetChildProperty(property, get, child);
}
- @Override
public List<SingleVariableDeclaration> patternVariables() {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
return new ArrayList<SingleVariableDeclaration>(Arrays.asList(getPatternVariable()));
}
@@ -138,12 +137,12 @@ public class TypePattern extends Pattern {
* <li>the node already has a parent</li>
* <li>a cycle in would be created</li>
* </ul>
- * @exception UnsupportedOperationException if this operation is used other than JLS18
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
* @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
*/
public void setPatternVariable(SingleVariableDeclaration patternVariable) {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
if (patternVariable == null) {
throw new IllegalArgumentException();
@@ -158,12 +157,12 @@ public class TypePattern extends Pattern {
* Returns the pattern variable of Types Pattern.
*
* @return the pattern variable
- * @exception UnsupportedOperationException if this operation is used other than JLS18
+ * @exception UnsupportedOperationException if this operation is used other than JLS19
* @exception UnsupportedOperationException if this expression is used with previewEnabled flag as false
* @noreference This method is not intended to be referenced by clients as it is a part of Java preview feature.
*/
public SingleVariableDeclaration getPatternVariable() {
- supportedOnlyIn18();
+ supportedOnlyIn19();
unsupportedWithoutPreviewError();
if (this.patternVariable == null) {
// lazy init must be thread-safe for readers
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 db5990c2b..8c2e5db2f 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
@@ -819,7 +819,7 @@ public class NaiveASTFlattener extends ASTVisitor {
public boolean visit(GuardedPattern node) {
if (DOMASTUtil.isPatternSupported(node.getAST())) {
node.getPattern().accept(this);
- this.buffer.append(" && ");//$NON-NLS-1$
+ this.buffer.append(" when ");//$NON-NLS-1$
node.getExpression().accept(this);
}
return false;
@@ -905,6 +905,7 @@ public class NaiveASTFlattener extends ASTVisitor {
return false;
}
+
@Override
public boolean visit(PatternInstanceofExpression node) {
node.getLeftOperand().accept(this);
@@ -1443,6 +1444,53 @@ public class NaiveASTFlattener extends ASTVisitor {
}
@Override
+ public boolean visit(RecordPattern node) {
+ if (DOMASTUtil.isPatternSupported(node.getAST())) {
+
+ if (node.getPatternType() != null) {
+ node.getPatternType().accept(this);
+ }
+ boolean addBraces = node.patterns().size() >= 1;
+ if (addBraces) {
+ this.buffer.append("(");//$NON-NLS-1$
+ }
+ int size = 1;
+ for (Pattern pattern : node.patterns()) {
+ visitPattern(pattern);
+ if (addBraces && size < node.patterns().size()) {
+ this.buffer.append(", ");//$NON-NLS-1$
+ }
+ size++;
+ }
+ if (addBraces) {
+ this.buffer.append(")");//$NON-NLS-1$
+ }
+ if (node.getPatternName() != null) {
+ this.buffer.append(" ");//$NON-NLS-1$
+ node.getPatternName().accept(this);
+ }
+ }
+ return false;
+ }
+
+ private boolean visitPattern(Pattern node) {
+ if (!DOMASTUtil.isPatternSupported(node.getAST())) {
+ return false;
+ }
+ if (node instanceof RecordPattern) {
+ return visit((RecordPattern) node);
+ }
+ if (node instanceof GuardedPattern) {
+ return visit((GuardedPattern) node);
+ }
+ if (node instanceof TypePattern) {
+ return visit((TypePattern) node);
+ }
+ return false;
+ }
+
+
+ @Override
public boolean visit(RequiresDirective node) {
printIndent();
this.buffer.append("requires");//$NON-NLS-1$
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
index 69f3f4306..071b9ac73 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java
@@ -2344,6 +2344,21 @@ public final class ASTRewriteAnalyzer extends ASTVisitor {
}
@Override
+ public boolean visit(RecordPattern node) {
+ if (!DOMASTUtil.isPatternSupported(node.getAST())) {
+ return false;
+ }
+ if (!hasChildrenChanges(node)) {
+ return doVisitUnchangedChildren(node);
+ }
+
+ int pos = rewriteRequiredNode(node, RecordPattern.PATTERN_TYPE_PROPERTY);
+ rewriteNodeList(node, RecordPattern.PATTERNS_PROPERTY, pos, Util.EMPTY_STRING, ", "); //$NON-NLS-1$
+ rewriteRequiredNode(node, RecordPattern.PATTERN_NAME_PROPERTY);
+ return false;
+ }
+
+ @Override
public boolean visit(ReturnStatement node) {
try {
this.beforeRequiredSpaceIndex = getScanner().getTokenEndOffset(TerminalTokens.TokenNamereturn, node.getStartPosition());
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 74e1309e6..12593d873 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
@@ -612,7 +612,7 @@ public class ASTRewriteFlattener extends ASTVisitor {
public boolean visit(GuardedPattern node) {
if (DOMASTUtil.isPatternSupported(node.getAST())) {
node.getPattern().accept(this);
- this.result.append(" && ");//$NON-NLS-1$
+ this.result.append(" when ");//$NON-NLS-1$
node.getExpression().accept(this);
}
return false;
@@ -968,6 +968,52 @@ public class ASTRewriteFlattener extends ASTVisitor {
}
@Override
+ public boolean visit(RecordPattern node) {
+ if (DOMASTUtil.isPatternSupported(node.getAST())) {
+
+ if (node.getPatternType() != null) {
+ node.getPatternType().accept(this);
+ }
+ boolean addBraces = node.patterns().size() >= 1;
+ if (addBraces) {
+ this.result.append("(");//$NON-NLS-1$
+ }
+ int size = 1;
+ for (Pattern pattern : node.patterns()) {
+ visitPattern(pattern);
+ if (addBraces && size < node.patterns().size()) {
+ this.result.append(", ");//$NON-NLS-1$
+ }
+ size++;
+ }
+ if (addBraces) {
+ this.result.append(")");//$NON-NLS-1$
+ }
+ if (node.getPatternName() != null) {
+ this.result.append(" ");//$NON-NLS-1$
+ node.getPatternName().accept(this);
+ }
+ }
+ return false;
+ }
+
+ private boolean visitPattern(Pattern node) {
+ if (!DOMASTUtil.isPatternSupported(node.getAST())) {
+ return false;
+ }
+ if (node instanceof RecordPattern) {
+ return visit((RecordPattern) node);
+ }
+ if (node instanceof GuardedPattern) {
+ return visit((GuardedPattern) node);
+ }
+ if (node instanceof TypePattern) {
+ return visit((TypePattern) node);
+ }
+ return false;
+ }
+
+ @Override
public boolean visit(RequiresDirective node) {
this.result.append("requires "); //$NON-NLS-1$
visitList(node, RequiresDirective.MODIFIERS_PROPERTY, String.valueOf(' '), Util.EMPTY_STRING, String.valueOf(' '));
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
index 9cc4659c5..18159cbdf 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java
@@ -203,7 +203,8 @@ public class DOMASTUtil {
private static final String[] AST_COMPLIANCE_MAP = {"-1","-1",JavaCore.VERSION_1_2, JavaCore.VERSION_1_3, JavaCore.VERSION_1_7, //$NON-NLS-1$ //$NON-NLS-2$
JavaCore.VERSION_1_7, JavaCore.VERSION_1_7, JavaCore.VERSION_1_7, JavaCore.VERSION_1_8, JavaCore.VERSION_9, JavaCore.VERSION_10,
- JavaCore.VERSION_11, JavaCore.VERSION_12, JavaCore.VERSION_13, JavaCore.VERSION_14, JavaCore.VERSION_15, JavaCore.VERSION_16, JavaCore.VERSION_17, JavaCore.VERSION_18};
+ JavaCore.VERSION_11, JavaCore.VERSION_12, JavaCore.VERSION_13, JavaCore.VERSION_14, JavaCore.VERSION_15, JavaCore.VERSION_16, JavaCore.VERSION_17, JavaCore.VERSION_18,
+ JavaCore.VERSION_19};
/**
* Calculates the JavaCore Option value string corresponding to the input ast level.
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 a1315c388..84d65878c 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
@@ -1178,6 +1178,10 @@ public class DefaultCodeFormatterConstants {
* - possible values: { COMMON_LINES, SEPARATE_LINES_IF_NOT_EMPTY, SEPARATE_LINES_IF_WRAPPED, SEPARATE_LINES, PRESERVE_POSITIONS }
* - default: COMMON_LINES
* </pre>
+ *
+ * Note that there is a typo ({@code delcaration} vs. {@code declaration})
+ * in the option name. It has to remain, as fixing it would be a breaking
+ * change.
* @see #COMMON_LINES
* @see #SEPARATE_LINES_IF_NOT_EMPTY
* @see #SEPARATE_LINES_IF_WRAPPED
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 33d1ac306..1be1d3909 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
@@ -347,7 +347,7 @@ public class DefaultCodeFormatter extends CodeFormatter {
}
private ASTParser createParser(int kind) {
- ASTParser parser = ASTParser.newParser(AST.JLS18);
+ ASTParser parser = ASTParser.newParser(AST.JLS19);
if (kind == K_MODULE_INFO) {
parser.setSource(createDummyModuleInfoCompilationUnit());
diff --git a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
index 281b3135a..df445c0b0 100644
--- a/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
+++ b/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java
@@ -190,10 +190,12 @@ public class SpacePreparator extends ASTVisitor {
List<TypeParameter> typeParameters = node.typeParameters();
handleTypeParameters(typeParameters);
- if (!node.isInterface() && !node.superInterfaceTypes().isEmpty()) {
- // fix for: class A<E> extends ArrayList<String>implements Callable<String>
- handleToken(node.getName(), TokenNameimplements, true, false);
- }
+ if (!node.superInterfaceTypes().isEmpty())
+ handleTokenAfter(node.getName(), node.isInterface() ? TokenNameextends : TokenNameimplements, true, true);
+ if (node.getSuperclassType() != null)
+ handleTokenAfter(node.getName(), TokenNameextends, true, true);
+ if (!node.permittedTypes().isEmpty())
+ handleTokenAfter(node.getName(), TokenNameRestrictedIdentifierpermits, true, true);
handleToken(node.getName(), TokenNameLBRACE,
this.options.insert_space_before_opening_brace_in_type_declaration, false);
@@ -273,18 +275,19 @@ public class SpacePreparator extends ASTVisitor {
}
List<SingleVariableDeclaration> components = node.recordComponents();
- if (handleEmptyParens(node, this.options.insert_space_between_empty_parens_in_constructor_declaration)) {
- handleToken(node, TokenNameLPAREN,
+ ASTNode nodeBeforeLParen = typeParameters.isEmpty() ? node.getName()
+ : typeParameters.get(typeParameters.size() - 1);
+ ASTNode nodeBeforeRParen = components.isEmpty() ? nodeBeforeLParen
+ : components.get(components.size() - 1);
+ if (handleEmptyParens(nodeBeforeLParen, this.options.insert_space_between_empty_parens_in_constructor_declaration)) {
+ handleTokenAfter(nodeBeforeLParen, TokenNameLPAREN,
this.options.insert_space_before_opening_paren_in_record_declaration, false);
} else {
- handleToken(node, TokenNameLPAREN,
+ handleTokenAfter(nodeBeforeLParen, TokenNameLPAREN,
this.options.insert_space_before_opening_paren_in_record_declaration,
this.options.insert_space_after_opening_paren_in_record_declaration);
-
- if (this.options.insert_space_before_closing_paren_in_record_declaration) {
- ASTNode nodeBeforeBrace = components.isEmpty() ? node.getName() : components.get(components.size() - 1);
- handleTokenAfter(nodeBeforeBrace, TokenNameRPAREN, true, false);
- }
+ handleTokenAfter(nodeBeforeRParen, TokenNameRPAREN,
+ this.options.insert_space_before_closing_paren_in_record_declaration, false);
}
handleCommas(components, this.options.insert_space_before_comma_in_record_components,
this.options.insert_space_after_comma_in_record_components);
@@ -374,7 +377,8 @@ public class SpacePreparator extends ASTVisitor {
this.options.insert_space_after_opening_angle_bracket_in_type_parameters);
handleTokenAfter(typeParameters.get(typeParameters.size() - 1), TokenNameGREATER,
this.options.insert_space_before_closing_angle_bracket_in_type_parameters,
- this.options.insert_space_after_closing_angle_bracket_in_type_parameters);
+ typeParameters.get(0).getParent() instanceof RecordDeclaration ? false
+ : this.options.insert_space_after_closing_angle_bracket_in_type_parameters);
handleCommas(typeParameters, this.options.insert_space_before_comma_in_type_parameters,
this.options.insert_space_after_comma_in_type_parameters);
}
@@ -470,8 +474,7 @@ public class SpacePreparator extends ASTVisitor {
@Override
public boolean visit(GuardedPattern node) {
- handleTokenAfter(node.getPattern(), TokenNameAND_AND, this.options.insert_space_before_logical_operator,
- this.options.insert_space_after_logical_operator);
+ handleTokenAfter(node.getPattern(), TokenNameRestrictedIdentifierWhen, true, true);
return true;
}
diff --git a/org.eclipse.jdt.core/grammar/java.g b/org.eclipse.jdt.core/grammar/java.g
index 1b4f08eb2..43261db3e 100644
--- a/org.eclipse.jdt.core/grammar/java.g
+++ b/org.eclipse.jdt.core/grammar/java.g
@@ -131,6 +131,7 @@ $Terminals
RestrictedIdentifiersealed
RestrictedIdentifierpermits
BeginCaseElement
+ RestrictedIdentifierWhen
-- {ObjectTeams
ATOT
@@ -259,8 +260,9 @@ Goal ::= '->' SwitchLabelCaseLhs
-- JSR 360 Restricted
Goal ::= RestrictedIdentifiersealed Modifiersopt
Goal ::= RestrictedIdentifierpermits PermittedSubclasses
--- jsr 406 --
+-- jsr 427 --
Goal ::= BeginCaseElement Pattern
+Goal ::= RestrictedIdentifierWhen Expression
/:$readableName Goal:/
-- {ObjectTeams
@@ -741,7 +743,7 @@ TypeDeclaration ::= ';'
-----------------------------------------------
TypeDeclaration -> EnumDeclaration
TypeDeclaration -> AnnotationTypeDeclaration
--- 14 preview feature
+-- Java 14 feature
TypeDeclaration -> RecordDeclaration
/:$readableName TypeDeclaration:/
@@ -915,7 +917,7 @@ ClassMemberDeclaration -> InterfaceDeclaration
-- 1.5 feature
ClassMemberDeclaration -> EnumDeclaration
ClassMemberDeclaration -> AnnotationTypeDeclaration
--- 14 preview feature
+-- Java 14 feature
ClassMemberDeclaration -> RecordDeclaration
/:$readableName ClassMemberDeclaration:/
@@ -1573,7 +1575,7 @@ InterfaceMemberDeclaration -> RecordDeclaration
/:$readableName InterfaceMemberDeclaration:/
-----------------------------------------------
--- 14 preview feature : record type
+-- 14 feature : record type
-----------------------------------------------
RecordDeclaration ::= RecordHeaderPart RecordBody
@@ -1681,7 +1683,7 @@ CompactConstructorHeaderName ::= Modifiersopt TypeParameters 'Identifier'
/:$compliance 14:/
-----------------------------------------------
--- 14 preview feature : end of record type
+-- 14 feature : end of record type
-----------------------------------------------
-----------------------------------------------
@@ -1694,8 +1696,7 @@ InstanceofExpression ::= InstanceofExpression InstanceofRHS
/:$readableName Expression:/
InstanceofRHS -> InstanceofClassic
-InstanceofRHS -> InstanceofPrimaryTypePattern
-InstanceofRHS -> InstanceofPrimaryParenPattern
+InstanceofRHS -> InstanceofPattern
/.$putCase consumeInstanceOfRHS(); $break ./
/:$readableName Expression:/
@@ -1703,23 +1704,17 @@ InstanceofClassic ::= 'instanceof' Modifiersopt Type
/.$putCase consumeInstanceOfClassic(); $break ./
/:$readableName InstanceofClassic:/
-InstanceofPrimaryTypePattern ::= 'instanceof' Modifiersopt Type 'Identifier'
-/.$putCase consumeInstanceofPrimaryTypePattern(); $break ./
-/:$readableName InstanceofPrimaryTypePattern:/
+InstanceofPattern ::= 'instanceof' Pattern
+/.$putCase consumeInstanceofPattern(); $break ./
+/:$readableName InstanceofPattern:/
-InstanceofPrimaryParenPattern ::= 'instanceof' ParenthesizedPattern
-/.$putCase consumeInstanceofPrimaryParenPattern(); $break ./
-/:$readableName InstanceofPrimaryParenPattern:/
-Pattern -> PrimaryPattern
-Pattern -> GuardedPattern
+Pattern -> TypePattern
+Pattern -> ParenthesizedPattern
+Pattern -> RecordPattern
+/.$putCase consumePattern(); $break ./
/:$readableName Pattern:/
-PrimaryPattern -> TypePattern
-PrimaryPattern -> ParenthesizedPattern
-/.$putCase consumePrimaryPattern(); $break ./
-/:$readableName PrimaryPattern:/
-
ParenthesizedPattern ::= PushLPAREN Pattern PushRPAREN
/.$putCase consumeParenthesizedPattern(); $break ./
/:$readableName ParenthesizedPattern:/
@@ -1728,14 +1723,46 @@ TypePattern ::= Modifiersopt Type 'Identifier'
/.$putCase consumeTypePattern(); $break ./
/:$readableName TypePattern:/
-GuardedPattern ::= PrimaryPattern '&&' ConditionalAndExpression
-/.$putCase consumeGuardedPattern(); $break ./
-/:$readableName GuardedPattern:/
-
-----------------------------------------------
-- 16 feature : end of instanceof pattern matching
-----------------------------------------------
+-----------------------------------------------
+-- 19 preview feature : record patterns
+-----------------------------------------------
+
+RecordPattern ::= Modifiersopt Type RecordStructurePattern
+/.$putCase consumeRecordPattern(); $break ./
+/:$readableName RecordPattern:/
+/:$compliance 19:/
+
+RecordPattern ::= Modifiersopt Type RecordStructurePattern 'Identifier'
+/.$putCase consumeRecordPatternWithId(); $break ./
+/:$readableName RecordPatternWithId:/
+/:$compliance 19:/
+
+RecordStructurePattern ::= PushLPAREN RecordComponentPatternsopt PushRPAREN
+RecordStructurePattern ::= PushLPAREN RecordComponentPatternList PushRPAREN
+/.$putCase consumeRecordStructure(); $break ./
+/:$readableName RecordStructurePattern:/
+/:$compliance 19:/
+
+RecordComponentPatternsopt ::= $empty
+/.$putCase consumeRecordComponentPatternsopt(); $break ./
+/:$readableName RecordComponentsopt:/
+/:$compliance 19:/
+
+
+RecordComponentPatternList ::= 'Pattern'
+RecordComponentPatternList ::= RecordComponentPatternList ',' 'Pattern'
+/.$putCase consumeRecordComponentPatternList(); $break ./
+/:$readableName RecordComponentPatternList:/
+/:$compliance 19:/
+
+-----------------------------------------------
+-- 19 preview feature : end of record patterns
+-----------------------------------------------
+
ConstantDeclaration -> FieldDeclaration
/:$readableName ConstantDeclaration:/
@@ -2001,10 +2028,23 @@ CaseLabelElement ::= 'default'
/.$putCase consumeCaseLabelElement(CaseLabelKind.CASE_DEFAULT); $break ./
/:$readableName CaseLabelElement:/
-CaseLabelElement ::= BeginCaseElement Pattern
+CaseLabelElement ::= CaseLabelElementPattern
/.$putCase consumeCaseLabelElement(CaseLabelKind.CASE_PATTERN); $break ./
/:$readableName CaseLabelElement:/
+CaseLabelElement ::= CaseLabelElementPattern Guard
+/.$putCase consumeCaseLabelElement(CaseLabelKind.CASE_PATTERN); $break ./
+/:$readableName CaseLabelElement:/
+
+CaseLabelElementPattern ::= BeginCaseElement Pattern
+/.$putCase consumeCaseLabelElementPattern(); $break ./
+/:$readableName CaseLabelElementPattern:/
+
+Guard ::= RestrictedIdentifierWhen Expression
+/.$putCase consumeGuard(); $break ./
+/:$readableName Guard:/
+/:$compliance 19:/
+
YieldStatement ::= RestrictedIdentifierYield Expression ;
/.$putCase consumeStatementYield() ; $break ./
/:$readableName YieldStatement:/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
index 6f097c855..45047197c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java
@@ -14,6 +14,7 @@
package org.eclipse.jdt.core;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.internal.core.JavaModelManager;
/**
* Interface of a classpath container.
@@ -141,5 +142,16 @@ public interface IClasspathContainer {
* @return IPath - the container path that is associated with this container
*/
IPath getPath();
+
+ /**
+ * Answer the IDs of all registered classpath containers (extensions at extension point
+ * {@link JavaModelManager#CPCONTAINER_INITIALIZER_EXTPOINT_ID}).
+ * @return array of strings as extracted from the "id" attribute from all registered
+ * classpath containers.
+ * @since 3.32
+ */
+ public static String[] getRegisteredContainerIds() {
+ return JavaModelManager.getRegisteredContainerIDs();
+ }
}
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 38d653d7f..5fa327ae2 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
@@ -2668,6 +2668,25 @@ public final class JavaCore extends Plugin {
* @since 3.18
*/
public static final String COMPILER_PB_REPORT_PREVIEW_FEATURES = PLUGIN_ID + ".compiler.problem.reportPreviewFeatures"; //$NON-NLS-1$
+
+ /**
+ * Compiler option ID: Ignore unnamed module for split package.
+ * <p>
+ * With this option the compiler will deliberately accept programs violating JLS in a specific way.
+ * Instead the compiler will behave in accordance to the original, but unmaintained document
+ * <a href="https://openjdk.org/projects/jigsaw/spec/sotms/#the-unnamed-module">"The State of the Module System"</a>,
+ * which indicates that different semantics had been intended.
+ * </p>
+ *
+ * <dl>
+ * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.ignoreUnnamedModuleForSplitPackage"</code></dd>
+ * <dt>Possible values:</dt><dd><code>{ "enabled", "disabled" }</code></dd>
+ * <dt>Default:</dt><dd><code>"disabled"</code></dd>
+ * </dl>
+ * @category CompilerOptionID
+ * @since 3.32
+ */
+ public static final String COMPILER_IGNORE_UNNAMED_MODULE_FOR_SPLIT_PACKAGE = PLUGIN_ID + ".compiler.ignoreUnnamedModuleForSplitPackage"; //$NON-NLS-1$"
/**
* Core option ID: Set the timeout value for retrieving the method's parameter names from javadoc.
* <p>Timeout in milliseconds to retrieve the method's parameter names from javadoc.</p>
@@ -3180,12 +3199,19 @@ public final class JavaCore extends Plugin {
public static final String VERSION_18 = "18"; //$NON-NLS-1$
/**
* Configurable option value: {@value}.
+ * @since 3.32
+ * @category OptionValue
+ */
+ public static final String VERSION_19 = "19"; //$NON-NLS-1$
+ /**
+ * Configurable option value: {@value}.
* @since 3.4
* @category OptionValue
*/
public static final String VERSION_CLDC_1_1 = "cldc1.1"; //$NON-NLS-1$
private static List<String> allVersions = Collections.unmodifiableList(Arrays.asList(VERSION_CLDC_1_1, VERSION_1_1, VERSION_1_2, VERSION_1_3, VERSION_1_4, VERSION_1_5,
- VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18));
+ VERSION_1_6, VERSION_1_7, VERSION_1_8, VERSION_9, VERSION_10, VERSION_11, VERSION_12, VERSION_13, VERSION_14, VERSION_15, VERSION_16, VERSION_17, VERSION_18,
+ VERSION_19));
/**
* Returns all {@link JavaCore}{@code #VERSION_*} levels in the order of their
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 e2cf02cd4..c9b50b4e9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -213,6 +213,9 @@ public interface ITerminalSymbols {
/** @since 3.30 */
int TokenNamenon_sealed = 414;
+ /** @since 3.32 */
+ int TokenNameRestrictedIdentifierWhen = 415;
+
//{ObjectTeams: mirrored from auto-generated TerminalTokens.java. Note: the values here must be constant across Eclipse-versions, so do not simply copy the identifiers!
// Take values from 5000 upwards
int
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
index c01127e66..d17c52729 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java
@@ -536,6 +536,12 @@ public boolean equals(Object obj) {
CompilationUnit other = (CompilationUnit)obj;
return this.owner.equals(other.owner) && super.equals(obj);
}
+
+@Override
+public int hashCode() {
+ return Util.combineHashCodes(super.hashCode(), this.owner.hashCode());
+}
+
/**
* @see ICompilationUnit#findElements(IJavaElement)
*/
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java
index 6ca604283..89048a3e2 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java
@@ -38,4 +38,7 @@ public class JavaElementInfo implements Cloneable {
public IJavaElement[] getChildren() {
return JavaElement.NO_ELEMENTS;
}
+ public IJavaElement[] getExtendedChildren() {
+ return JavaElement.NO_ELEMENTS;
+ }
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
index ade6e81bb..6d798e07b 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java
@@ -4076,11 +4076,16 @@ public class JavaModelManager implements ISaveParticipant, IContentTypeChangeLis
private void closeChildren(Object info) {
if (info instanceof JavaElementInfo) {
- IJavaElement[] children = ((JavaElementInfo)info).getChildren();
- for (int i = 0, size = children.length; i < size; ++i) {
- JavaElement child = (JavaElement) children[i];
+ for (IJavaElement child: ((JavaElementInfo)info).getChildren()) {
try {
- child.close();
+ ((JavaElement)child).close();
+ } catch (JavaModelException e) {
+ // ignore
+ }
+ }
+ for (IJavaElement child: ((JavaElementInfo)info).getExtendedChildren()) {
+ try {
+ ((JavaElement)child).close();
} catch (JavaModelException e) {
// ignore
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
index 3c989f031..bddfb28fd 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,7 +15,6 @@
package org.eclipse.jdt.internal.core;
import org.eclipse.jdt.core.*;
-import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.compiler.CharOperation;
import org.eclipse.jdt.internal.compiler.env.ISourceMethod;
@@ -107,4 +106,10 @@ protected void setExceptionTypeNames(char[][] types) {
this.exceptionTypes = types;
}
protected abstract void setReturnType(char[] type);
+
+@Override
+public IJavaElement[] getExtendedChildren() {
+ return this.arguments != null ? this.arguments : JavaElement.NO_ELEMENTS;
+}
+
}
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
index cd363a0a4..8e1836d82 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java
@@ -722,10 +722,14 @@ protected void storeProblemsFor(SourceFile sourceFile, CategorizedProblem[] prob
// handle buildpath problems (missing classfile, unresolved add-reads...)
String buildPathProblemMessage = null;
- if (id == IProblem.IsClassPathCorrect) {
- buildPathProblemMessage = Messages.bind(Messages.build_incompleteClassPath, problem.getArguments()[0]);
- } else if (id == IProblem.UndefinedModuleAddReads) {
- buildPathProblemMessage = Messages.bind(Messages.build_errorOnModuleDirective, problem.getMessage());
+ switch (id) {
+ case IProblem.IsClassPathCorrect:
+ case IProblem.IsClassPathCorrectWithReferencingType:
+ buildPathProblemMessage = Messages.bind(Messages.build_incompleteClassPath, problem.getArguments()[0]);
+ break;
+ case IProblem.UndefinedModuleAddReads:
+ buildPathProblemMessage = Messages.bind(Messages.build_errorOnModuleDirective, problem.getMessage());
+ break;
}
if (buildPathProblemMessage != null) {
if (JavaBuilder.DEBUG)
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
index d14a396dd..c70c17ade 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2021 IBM Corporation and others.
+ * Copyright (c) 2000, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -280,6 +280,7 @@ public class PublicScanner implements IScanner, ITerminalSymbols {
case TerminalTokens.TokenNamevoid : nextToken = ITerminalSymbols.TokenNamevoid; break;
case TerminalTokens.TokenNamevolatile : nextToken = ITerminalSymbols.TokenNamevolatile; break;
case TerminalTokens.TokenNamewhen : nextToken = ITerminalSymbols.TokenNamewhen; break;
+ case TerminalTokens.TokenNameRestrictedIdentifierWhen : nextToken = ITerminalSymbols.TokenNameRestrictedIdentifierWhen; break;
case TerminalTokens.TokenNamewhile : nextToken = ITerminalSymbols.TokenNamewhile; break;
case TerminalTokens.TokenNamewith : nextToken = ITerminalSymbols.TokenNamewith; break;
case TerminalTokens.TokenNamewithin : nextToken = ITerminalSymbols.TokenNamewithin; break;
diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml
index 07dfaa262..983ab9429 100644
--- a/org.eclipse.jdt.core/pom.xml
+++ b/org.eclipse.jdt.core/pom.xml
@@ -14,10 +14,10 @@
<parent>
<artifactId>eclipse.jdt.core</artifactId>
<groupId>org.eclipse.jdt</groupId>
- <version>4.25.0-SNAPSHOT</version>
+ <version>4.26.0-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.jdt.core</artifactId>
- <version>3.31.0-SNAPSHOT</version>
+ <version>3.32.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
diff --git a/org.eclipse.jdt.core/scripts/.gitignore b/org.eclipse.jdt.core/scripts/.gitignore
index 53930a676..8122a6b89 100644
--- a/org.eclipse.jdt.core/scripts/.gitignore
+++ b/org.eclipse.jdt.core/scripts/.gitignore
@@ -1,3 +1,3 @@
/backup
/output
-/*.class
+/GenerateParserScript.class
diff --git a/org.eclipse.jdt.core/scripts/binary/META-INF/MANIFEST.MF b/org.eclipse.jdt.core/scripts/binary/META-INF/MANIFEST.MF
index 2fa22c5f5..d3570bc6c 100644
--- a/org.eclipse.jdt.core/scripts/binary/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.core/scripts/binary/META-INF/MANIFEST.MF
@@ -1,4 +1,5 @@
Manifest-Version: 1.0
+Main-Class: org.eclipse.jdt.internal.compiler.batch.Main
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse Compiler for Java(TM)
Bundle-SymbolicName: org.eclipse.jdt.core.compiler.batch
@@ -7,6 +8,7 @@ Bundle-ClassPath: .
Bundle-Vendor: Eclipse.org
Export-Package: org.eclipse.jdt.core,
org.eclipse.jdt.core.compiler,
+ org.eclipse.jdt.core.compiler.batch,
org.eclipse.jdt.internal.antadapter;x-internal:=true,
org.eclipse.jdt.internal.compiler;x-internal:=true,
org.eclipse.jdt.internal.compiler.apt.dispatch;x-internal:=true,
@@ -25,4 +27,3 @@ Export-Package: org.eclipse.jdt.core,
org.eclipse.jdt.internal.compiler.problem;x-internal:=true,
org.eclipse.jdt.internal.compiler.util;x-internal:=true,
org.eclipse.jdt.internal.compiler.tool;x-internal:=true
-Main-Class: org.eclipse.jdt.internal.compiler.batch.Main
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java
index 1f02dcc99..f99d9a0a7 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java
@@ -258,7 +258,7 @@ HashtableOfObject addQueryResults(char[][] categories, char[] key, int matchRule
return results;
}
-private void cacheDocumentNames() throws IOException {
+private synchronized void cacheDocumentNames() throws IOException {
// will need all document names so get them now
this.cachedChunks = new String[this.numberOfChunks][];
try (InputStream stream = this.indexLocation.getInputStream()) {
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java
index 2cfdf807b..e464673dc 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java
@@ -22,7 +22,9 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaElement;
@@ -415,6 +417,11 @@ private int indexOf(String containerPath, String relativePath) {
* Returns whether the enclosing path encloses the given path (or is equal to it)
*/
private boolean encloses(String enclosingPath, String path, int index) {
+ if (path.indexOf(JAR_FILE_ENTRY_SEPARATOR) != -1) {
+ String message = "Unexpected symbol '" + JAR_FILE_ENTRY_SEPARATOR + "' in path \"" + path + "\"."; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+ Status warning = new Status(IStatus.WARNING, JavaCore.PLUGIN_ID, IStatus.ERROR, message, new IllegalArgumentException());
+ Util.log(warning);
+ }
// normalize given path as it can come from outside
path = normalize(path);
@@ -499,7 +506,15 @@ private IPath getPath(IJavaElement element, boolean relativeToRoot) {
@Override
public AccessRuleSet getAccessRuleSet(String relativePath, String containerPath) {
- int index = indexOf(containerPath, relativePath);
+ int index;
+ // check if there is a module in the relative path, if so remove it
+ int separatorIndex = relativePath.indexOf(JAR_FILE_ENTRY_SEPARATOR);
+ if (separatorIndex != -1) {
+ String relativePathWithoutModule = relativePath.substring(separatorIndex+1);
+ index = indexOf(containerPath, relativePathWithoutModule);
+ } else {
+ index = indexOf(containerPath, relativePath);
+ }
if (index == -1) {
// this search scope does not enclose given path
return NOT_ENCLOSED;
@@ -587,6 +602,11 @@ public IPackageFragmentRoot packageFragmentRoot(String resourcePathString, int j
if (isJarFile) {
// internal or external jar (case 3, 4, or 5)
String relativePath = resourcePathString.substring(jarSeparatorIndex+1);
+ // Module in the jar
+ int moduleSeparatorIndex = relativePath.indexOf(JAR_FILE_ENTRY_SEPARATOR);
+ if (moduleSeparatorIndex != -1) {
+ relativePath = relativePath.substring(moduleSeparatorIndex+1);
+ }
index = indexOf(jarPath, relativePath);
} else {
// resource in workspace (case 1 or 2)
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
index cc7141a44..0a80f8ab9 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java
@@ -213,7 +213,14 @@ public class SourceIndexer extends AbstractIndexer implements ITypeRequestor, Su
AbstractMethodDeclaration[] methods = type.methods;
for (int j = 0, length = methods == null ? 0 : methods.length; j < length; j++) {
AbstractMethodDeclaration method = methods[j];
- if (method != null && (method.bits & ASTNode.HasFunctionalInterfaceTypes) == 0) {
+ /*
+ * In case the method defines a local type, skip purging the method body.
+ * We don't know if the local type defines a method that uses a method reference or a lambda.
+ * See:
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/432
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=566435
+ */
+ if (method != null && (method.bits & (ASTNode.HasFunctionalInterfaceTypes | ASTNode.HasLocalType)) == 0) {
method.statements = null;
method.javadoc = null;
}
diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
index b66303197..fad008d2a 100644
--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java
@@ -2801,6 +2801,9 @@ protected void reportMatching(AbstractMethodDeclaration method, TypeDeclaration
if ((this.matchContainer & PatternLocator.METHOD_CONTAINER) != 0) {
if (enclosingElement == null) {
enclosingElement = createHandle(method, parent);
+ if (enclosingElement == null && (type.bits & ASTNode.IsAnonymousType) != 0) {
+ enclosingElement = createHandleFromNestAncestors(method, parent);
+ }
}
if (encloses(enclosingElement)) {
if (this.pattern.mustResolve) {
@@ -2833,6 +2836,7 @@ protected void reportMatching(AbstractMethodDeclaration method, TypeDeclaration
}
}
}
+
/**
* Report matching in annotations.
* @param otherElements TODO
@@ -3331,24 +3335,7 @@ protected void reportMatching(TypeDeclaration type, IJavaElement parent, int acc
} else if (enclosingElement instanceof IMember) {
IMember member = (IMember) parent;
if (member.isBinary()) {
- IOpenable openable = enclosingElement.getOpenable();
- IJavaElement anonType = null;
- if (openable instanceof ClassFile) {
- BinaryType binaryType = (BinaryType)((ClassFile) openable).getType();
- String fileName = binaryType.getPath().toOSString();
- if ((type.bits & ASTNode.IsAnonymousType) != 0) {
- if (fileName != null) {
- if (fileName.endsWith("jar") || fileName.endsWith(SuffixConstants.SUFFIX_STRING_class)) { //$NON-NLS-1$
- IOrdinaryClassFile classFile= binaryType.getPackageFragment().getOrdinaryClassFile(binaryType.getTypeQualifiedName() +
- "$" + Integer.toString(occurrenceCount) + SuffixConstants.SUFFIX_STRING_class);//$NON-NLS-1$
- anonType = classFile.getType();
- }
- } else {
- // TODO: JAVA 9 - JIMAGE to be included later - currently assuming that only .class files will be dealt here.
- }
- }
- }
- enclosingElement = anonType != null ? anonType : ((IOrdinaryClassFile)this.currentPossibleMatch.openable).getType() ;
+ enclosingElement = ((IOrdinaryClassFile)this.currentPossibleMatch.openable).getType();
} else {
enclosingElement = member.getType(new String(type.name), occurrenceCount);
}
@@ -3913,4 +3900,54 @@ public Parser getPlainParser() {
return new Parser(this.parser.internalGetProblemReporter(), true);
}
// SH}
+/*
+ * Go through the nest hierarchy of a type, to try to create a method handle for a method declaration.
+ * Does not try to create a method handle for the specified type, only for types higher in the nest hierarchy.
+ *
+ * See:
+ * https://github.com/eclipse-jdt/eclipse.jdt.core/issues/375
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=468127
+ */
+private IJavaElement createHandleFromNestAncestors(AbstractMethodDeclaration method, IJavaElement type) throws JavaModelException {
+ BinaryType binaryType = getBinaryType(type);
+ if (binaryType != null) {
+ return findMethodInNestAncestors(method, binaryType);
+ }
+ return null;
+}
+
+/*
+ * Tries to find a method in the nest ancestors of a type. E.g. for Type$2$1, nest ancestors are: Type$1, Type
+ */
+private IJavaElement findMethodInNestAncestors(AbstractMethodDeclaration method, BinaryType binaryType) {
+ IJavaElement methodHandle = null;
+ int index = 0;
+ String typeQualifiedName = binaryType.getTypeQualifiedName();
+ // loop until we find the method or arrive at the nested classes host, e.g. for Type$2$1 the "visited" types are: Type$1, Type
+ while (methodHandle == null && index != -1) {
+ index = typeQualifiedName.lastIndexOf('$');
+ if (index != -1) {
+ typeQualifiedName = typeQualifiedName.substring(0, index);
+ }
+ String className = typeQualifiedName + SuffixConstants.SUFFIX_STRING_class;
+ IOrdinaryClassFile classFile = binaryType.getPackageFragment()
+ .getOrdinaryClassFile(className);
+ IType parentType = classFile.getType();
+ methodHandle = createHandle(method, parentType);
+ }
+ return methodHandle;
+}
+
+private BinaryType getBinaryType(IJavaElement type) {
+ BinaryType binaryType = null;
+ IMember member = (IMember) type;
+ if (member.isBinary()) {
+ IOpenable openable = member.getOpenable();
+ if (openable instanceof ClassFile) {
+ binaryType = (BinaryType) ((ClassFile) openable).getType();
+ }
+ }
+ return binaryType;
+}
+
}
diff --git a/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF
index 66e093ec4..7c8eedab4 100644
--- a/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt/META-INF/MANIFEST.MF
@@ -13,7 +13,7 @@ Export-Package: org.eclipse.objectteams.otdt.core.ext,
org.eclipse.objectteams.otdt.internal.core.ext;x-internal:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0.0)",
org.eclipse.core.resources;bundle-version="[3.8.0,4.0.0)",
- org.eclipse.jdt.core;bundle-version="[3.31.0.OTDT_r282,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.32.0.OTDT_r282,4.0.0)",
org.eclipse.jdt.launching;bundle-version="[3.6.100,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.7.100,4.0.0)",
org.eclipse.osgi;bundle-version="[3.10.0,4.0.0)",
diff --git a/releng/map/otdt.map.in b/releng/map/otdt.map.in
index 55fb15e5d..864f7ff2b 100644
--- a/releng/map/otdt.map.in
+++ b/releng/map/otdt.map.in
@@ -9,7 +9,7 @@ feature@org.eclipse.objectteams.otequinox.otre=GIT,repo=https://git.eclipse.org/
feature@org.eclipse.objectteams.otequinox.turbo=GIT,repo=https://git.eclipse.org/r/objectteams/org.eclipse.objectteams.git,path=features/org.eclipse.objectteams.otequinox.turbo.feature,tag=builds/201506091717
!-- Also don't use version numbers for those plugins that hold the various otre jars: --
-plugin@org.eclipse.jdt.core,3.31.0.OTDT_r282_qualifier=GIT,repo=https://git.eclipse.org/r/objectteams/org.eclipse.objectteams.git,path=org.eclipse.jdt.core
+plugin@org.eclipse.jdt.core,3.32.0.OTDT_r282_qualifier=GIT,repo=https://git.eclipse.org/r/objectteams/org.eclipse.objectteams.git,path=org.eclipse.jdt.core
!next plug-in don't specify version so that org.eclipse.objectteams.runtime/customBuildCallbacks.xml will find the plug-in directory:
plugin@org.eclipse.objectteams.otdt=GIT,repo=https://git.eclipse.org/r/objectteams/org.eclipse.objectteams.git,path=plugins/org.eclipse.objectteams.otdt
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutParameterBinding_LiftingAndLowering.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutParameterBinding_LiftingAndLowering.java
index aea8eb685..daa5392b8 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutParameterBinding_LiftingAndLowering.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/calloutbinding/CalloutParameterBinding_LiftingAndLowering.java
@@ -23,7 +23,6 @@ import java.util.Map;
import junit.framework.Test;
-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
import org.eclipse.objectteams.otdt.tests.otjld.AbstractOTJLDTest;
diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/regression/ReportedBugs.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/regression/ReportedBugs.java
index 558d35498..30e5c3412 100644
--- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/regression/ReportedBugs.java
+++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/regression/ReportedBugs.java
@@ -4083,7 +4083,7 @@ public class ReportedBugs extends AbstractOTJLDTest {
" \n" +
"public team class TeamB11sh86_3 extends TeamB11sh86_2 { }\n" +
" ^\n" +
- "The type TB11sh86_1 cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type TB11sh86_1 cannot be resolved. It is indirectly referenced from required type TeamB11sh86_2.R\n" +
"----------\n",
null/*classLibraries*/,
false/*shouldFlushOutputDirectory*/,
@@ -5363,7 +5363,7 @@ public class ReportedBugs extends AbstractOTJLDTest {
"1. ERROR in TBug372786.java (at line 1)\n" +
" import jarred.TeamBug372786;\n" +
" ^\n" +
- "The type notjarred.Missing cannot be resolved. It is indirectly referenced from required .class files\n" +
+ "The type notjarred.Missing cannot be resolved. It is indirectly referenced from required type jarred.TeamBug372786\n" +
"----------\n",
getClassLibraries(jarFilename),
false);

Back to the top