From 506a16a58af56788fc69c4aafbc35f9c292d8522 Mon Sep 17 00:00:00 2001 From: Eric Milles Date: Tue, 12 Jul 2022 10:49:13 -0500 Subject: [PATCH] Eclipse 4.25 (M1) JDT Patch for Groovy-Eclipse https://github.com/eclipse-jdt/eclipse.jdt.core/releases/tag/S4_25_0_M1 for #1377 --- ...Started-with-Groovy-Eclipse-Source-Code.md | 9 +- groovy-eclipse.setup | 56 +- .../.gitignore | 1 + .../.project | 12 + .../build.properties | 3 + .../feature.properties | 124 + .../feature.xml | 32 + .../license.html | 109 + .../pom.xml | 13 + .../.classpath | 15 + .../.gitignore | 2 + .../.project | 26 + .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.core.runtime.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 99 + .../.settings/org.eclipse.jdt.ui.prefs | 62 + .../META-INF/MANIFEST.MF | 19 + .../about.html | 36 + .../build.properties | 24 + .../forceQualifierUpdate.txt | 2 + .../plugin.properties | 15 + .../plugin.xml | 27 + .../pom.xml | 24 + .../core/tests/builder/AbstractLeakTest.java | 254 + .../tests/builder/AbstractMethodTests.java | 330 + .../builder/AnnotationDependencyTests.java | 1670 + .../core/tests/builder/BasicBuildTests.java | 690 + .../jdt/core/tests/builder/Bug530366Test.java | 152 + .../jdt/core/tests/builder/Bug531382Test.java | 129 + .../jdt/core/tests/builder/Bug544921Test.java | 415 + .../jdt/core/tests/builder/Bug549457Test.java | 116 + .../jdt/core/tests/builder/Bug549646Test.java | 73 + .../jdt/core/tests/builder/Bug561287Test.java | 71 + .../jdt/core/tests/builder/Bug562420Test.java | 70 + .../jdt/core/tests/builder/Bug564905Test.java | 202 + .../jdt/core/tests/builder/Bug571363Test.java | 83 + .../jdt/core/tests/builder/BuilderTests.java | 675 + .../core/tests/builder/BuildpathTests.java | 1054 + .../tests/builder/CompressedWriterTest.java | 148 + .../core/tests/builder/CopyResourceTests.java | 357 + .../core/tests/builder/DependencyTests.java | 1258 + .../builder/EfficiencyCompilerRequestor.java | 80 + .../core/tests/builder/EfficiencyTests.java | 415 + .../jdt/core/tests/builder/ErrorsTests.java | 648 + .../core/tests/builder/ExecutionTests.java | 88 + .../tests/builder/FriendDependencyTests.java | 325 + .../core/tests/builder/GetResourcesTests.java | 1018 + .../core/tests/builder/IncrementalTests.java | 1288 + .../tests/builder/IncrementalTests18.java | 811 + .../jdt/core/tests/builder/Java50Tests.java | 382 + .../core/tests/builder/LeakTestsAfter9.java | 48 + .../core/tests/builder/LeakTestsBefore9.java | 48 + .../core/tests/builder/MultiProjectTests.java | 2211 + ...MultiSourceFolderAndOutputFolderTests.java | 313 + .../core/tests/builder/OutputFolderTests.java | 323 + .../core/tests/builder/PackageInfoTest.java | 737 + .../jdt/core/tests/builder/PackageTests.java | 293 + .../tests/builder/ParticipantBuildTests.java | 537 + .../jdt/core/tests/builder/Problem.java | 145 + .../builder/ReferenceCollectionTest.java | 372 + .../jdt/core/tests/builder/StateTest.java | 357 + .../core/tests/builder/StaticFinalTests.java | 318 + .../builder/TestAttributeBuilderTests.java | 905 + .../tests/builder/TestBuilderParticipant.java | 50 + .../tests/builder/TestingEnvironment.java | 1243 + .../test.xml | 65 + .../workspace/Test571363.jar | Bin 0 -> 1250 bytes .../.classpath | 15 + .../.gitignore | 4 + .../.project | 26 + .../org.eclipse.core.resources.prefs | 2 + .../.settings/org.eclipse.core.runtime.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 128 + .../.settings/org.eclipse.jdt.ui.prefs | 56 + .../META-INF/MANIFEST.MF | 30 + .../META-INF/eclipse.inf | 3 + .../about.html | 36 + .../build.properties | 23 + .../forceQualifierUpdate.txt | 2 + .../plugin.properties | 15 + .../pom.xml | 48 + .../src/EvalTestsTarget.zip | Bin 0 -> 13598 bytes .../src/TestJavadocVisibility.zip | Bin 0 -> 7812 bytes .../jdt/core/tests/compiler/Activator.java | 52 + .../tests/compiler/CharDeduplicationTest.java | 187 + .../tests/compiler/DeduplicationUtilTest.java | 146 + .../compiler/map/CharArrayMapperTest.java | 263 + .../parser/AbstractCompletionTest.java | 457 + .../parser/AbstractSelectionTest.java | 335 + .../parser/AbstractSyntaxTreeTest.java | 489 + .../AllocationExpressionCompletionTest.java | 343 + .../AnnotationCompletionParserTest.java | 5147 ++ .../parser/AnnotationDietRecoveryTest.java | 1972 + .../parser/AnnotationSelectionTest.java | 645 + .../ClassLiteralAccessCompletionTest.java | 217 + .../compiler/parser/CompletionParserTest.java | 9163 +++ .../parser/CompletionParserTest18.java | 2347 + .../parser/CompletionParserTest2.java | 11802 ++++ .../parser/CompletionParserTestKeyword.java | 17264 +++++ .../parser/CompletionRecoveryTest.java | 1088 + .../parser/ComplianceDiagnoseTest.java | 3649 ++ .../compiler/parser/DietCompletionTest.java | 2036 + .../compiler/parser/DietRecoveryTest.java | 8287 +++ .../parser/DocumentElementParserTest.java | 178 + .../parser/DualParseSyntaxErrorTest.java | 362 + .../parser/EnumCompletionParserTest.java | 822 + .../compiler/parser/EnumDietRecoveryTest.java | 1167 + .../compiler/parser/EnumSelectionTest.java | 66 + ...itConstructorInvocationCompletionTest.java | 388 + ...citConstructorInvocationSelectionTest.java | 232 + .../parser/FieldAccessCompletionTest.java | 2446 + .../parser/GenericDietRecoveryTest.java | 1240 + .../parser/GenericsCompletionParserTest.java | 11256 ++++ .../parser/GenericsSelectionTest.java | 987 + .../parser/InnerTypeCompletionTest.java | 454 + .../parser/JavadocCompletionParserTest.java | 900 + .../parser/LabelStatementCompletionTest.java | 494 + .../parser/LambdaExpressionSyntaxTest.java | 720 + .../MethodInvocationCompletionTest.java | 867 + .../parser/ModuleDeclarationSyntaxTest.java | 639 + .../parser/NameReferenceCompletionTest.java | 928 + .../tests/compiler/parser/ParserTest.java | 827 + .../tests/compiler/parser/ParserTest1_7.java | 1260 + .../parser/PatternMatchingSelectionTest.java | 166 + .../parser/ReferenceExpressionSyntaxTest.java | 984 + .../parser/ReferenceTypeCompletionTest.java | 1570 + .../parser/RunCompletionParserTests.java | 152 + .../compiler/parser/SelectionJavadocTest.java | 909 + .../parser/SelectionParserTest10.java | 91 + .../parser/SelectionParserTest12.java | 791 + .../parser/SelectionParserTest13.java | 1070 + .../parser/SelectionParserTest18.java | 504 + .../compiler/parser/SelectionParserTest9.java | 373 + .../tests/compiler/parser/SelectionTest.java | 2518 + .../tests/compiler/parser/SelectionTest2.java | 233 + .../compiler/parser/SingleCompletionTest.java | 61 + .../parser/SourceElementParserTest.java | 5398 ++ .../tests/compiler/parser/SourceField.java | 123 + .../tests/compiler/parser/SourceImport.java | 59 + .../compiler/parser/SourceInitializer.java | 37 + .../tests/compiler/parser/SourceMethod.java | 177 + .../tests/compiler/parser/SourcePackage.java | 53 + .../tests/compiler/parser/SourceType.java | 313 + .../parser/StatementRecoveryTest.java | 3952 ++ .../parser/StatementRecoveryTest_1_5.java | 797 + .../compiler/parser/SyntaxErrorTest.java | 527 + .../core/tests/compiler/parser/TestAll.java | 280 + .../parser/TestSourceElementRequestor.java | 134 + .../parser/TypeAnnotationSyntaxTest.java | 3834 ++ .../compiler/regression/ASTImplTests.java | 1064 + .../regression/AbstractBatchCompilerTest.java | 961 + .../regression/AbstractComparableTest.java | 141 + .../AbstractNullAnnotationTest.java | 241 + .../regression/AbstractRegressionTest.java | 4089 ++ .../regression/AbstractRegressionTest9.java | 134 + .../regression/AmbiguousMethodTest.java | 4604 ++ .../compiler/regression/AnnotationTest.java | 12352 ++++ .../compiler/regression/AnnotationTest_9.java | 106 + .../tests/compiler/regression/ArrayTest.java | 599 + .../compiler/regression/AssertionTest.java | 643 + .../compiler/regression/AssignmentTest.java | 2184 + .../regression/AssignmentTest_1_5.java | 330 + .../regression/AssignmentTest_1_7.java | 72 + .../compiler/regression/AutoBoxingTest.java | 5277 ++ .../regression/AutomaticModuleNamingTest.java | 125 + .../regression/BatchCompilerTest.java | 13477 ++++ .../regression/BatchCompilerTest2.java | 471 + .../regression/BatchCompilerTest_14.java | 86 + .../regression/BatchCompilerTest_15.java | 110 + .../regression/BatchCompilerTest_16.java | 115 + .../regression/BinaryLiteralTest.java | 153 + .../compiler/regression/BooleanTest.java | 2456 + .../BootstrapMethodAttributeTest.java | 78 + .../tests/compiler/regression/CastTest.java | 3576 ++ .../regression/CharOperationTest.java | 174 + .../regression/ClassFileComparatorTest.java | 474 + .../regression/ClassFileReaderTest_17.java | 142 + .../regression/ClassFileReaderTest_1_4.java | 2878 + .../regression/ClassFileReaderTest_1_5.java | 622 + .../regression/ClassFileReaderTest_1_8.java | 597 + .../regression/ClasspathJmodTests.java | 267 + .../compiler/regression/CollisionCase.java | 92 + .../regression/CompilerInvocationTests.java | 2454 + .../compiler/regression/Compliance_1_3.java | 3506 + .../compiler/regression/Compliance_1_4.java | 3518 + .../compiler/regression/Compliance_1_5.java | 3618 ++ .../compiler/regression/Compliance_1_6.java | 76 + .../compiler/regression/Compliance_1_7.java | 233 + .../compiler/regression/Compliance_CLDC.java | 321 + .../ConcurrentBatchCompilerTest.java | 213 + .../regression/ConditionalExpressionTest.java | 632 + .../compiler/regression/ConstantTest.java | 1632 + .../regression/DebugAttributeTest.java | 292 + .../DefaultJavaRuntimeEnvironment.java | 90 + .../compiler/regression/Deprecated15Test.java | 308 + .../compiler/regression/Deprecated18Test.java | 64 + .../compiler/regression/Deprecated9Test.java | 1013 + .../compiler/regression/DeprecatedTest.java | 972 + .../EnclosingMethodAttributeTest.java | 260 + .../tests/compiler/regression/EnumTest.java | 7299 +++ .../regression/ExpressionContextTests.java | 664 + .../ExternalizeStringLiterals15Test.java | 279 + .../ExternalizeStringLiteralsTest.java | 817 + .../compiler/regression/FieldAccessTest.java | 826 + .../compiler/regression/FlowAnalysisTest.java | 4713 ++ .../regression/FlowAnalysisTest8.java | 632 + .../compiler/regression/ForStatementTest.java | 1788 + .../regression/ForeachStatementTest.java | 3076 + .../regression/GenericTypeSignatureTest.java | 1329 + .../compiler/regression/GenericTypeTest.java | 53005 ++++++++++++++++ .../regression/GenericsRegressionTest.java | 6685 ++ .../GenericsRegressionTest_1_7.java | 3087 + .../GenericsRegressionTest_1_8.java | 10364 +++ .../regression/GenericsRegressionTest_9.java | 729 + .../regression/GrammarCoverageTests308.java | 1629 + .../regression/InMemoryNameEnvironment.java | 90 + .../regression/InMemoryNameEnvironment9.java | 101 + .../regression/InitializationTests.java | 498 + .../compiler/regression/InnerClass15Test.java | 766 + .../regression/InnerEmulationTest.java | 7178 +++ .../regression/InnerEmulationTest_1_5.java | 351 + .../regression/InstanceofExpressionTest.java | 56 + .../InstanceofPrimaryPatternTest.java | 271 + .../regression/InterfaceMethodsTest.java | 3244 + .../regression/InterfaceMethodsTest_9.java | 418 + .../regression/InternalHexFloatTest.java | 413 + .../regression/InternalScannerTest.java | 72 + .../compiler/regression/JEP181NestTest.java | 1508 + .../regression/JEP286ReservedWordTest.java | 172 + .../tests/compiler/regression/JEP286Test.java | 1398 + .../regression/JEP323VarLambdaParamsTest.java | 346 + .../regression/JSR308SpecSnippetTests.java | 2911 + .../regression/JSR335ClassFileTest.java | 3260 + .../compiler/regression/JavadocBugsTest.java | 9272 +++ .../compiler/regression/JavadocTest.java | 654 + .../regression/JavadocTestForClass.java | 1142 + .../regression/JavadocTestForConstructor.java | 964 + .../regression/JavadocTestForField.java | 1061 + .../regression/JavadocTestForInterface.java | 2262 + .../regression/JavadocTestForMethod.java | 4982 ++ .../regression/JavadocTestForModule.java | 990 + .../regression/JavadocTestForRecord.java | 273 + .../compiler/regression/JavadocTestMixed.java | 877 + .../regression/JavadocTestOptions.java | 2223 + .../compiler/regression/JavadocTest_15.java | 758 + .../compiler/regression/JavadocTest_18.java | 374 + .../compiler/regression/JavadocTest_1_3.java | 3581 ++ .../compiler/regression/JavadocTest_1_4.java | 3570 ++ .../compiler/regression/JavadocTest_1_5.java | 4363 ++ .../tests/compiler/regression/Jsr14Test.java | 86 + .../regression/LambdaExpressionsTest.java | 7321 +++ .../regression/LambdaRegressionTest.java | 1223 + .../compiler/regression/LambdaShapeTests.java | 3287 + .../regression/LineNumberAttributeTest.java | 313 + .../compiler/regression/LocalEnumTest.java | 7844 +++ .../compiler/regression/LocalStaticsTest.java | 1710 + .../regression/LocalVariableTest.java | 924 + .../tests/compiler/regression/LookupTest.java | 3705 ++ .../tests/compiler/regression/MANIFEST.MF | 4 + .../regression/ManifestAnalyzerTest.java | 167 + .../compiler/regression/MethodHandleTest.java | 394 + .../MethodParametersAttributeTest.java | 985 + .../compiler/regression/MethodVerifyTest.java | 14487 +++++ .../regression/ModuleAttributeTests.java | 250 + .../regression/ModuleCompilationTests.java | 5888 ++ .../regression/MultiReleaseJarTests.java | 212 + .../NegativeLambdaExpressionsTest.java | 10090 +++ .../NegativeTypeAnnotationTest.java | 4419 ++ .../regression/NonFatalErrorTest.java | 590 + .../NullAnnotationBatchCompilerTest.java | 1119 + .../regression/NullAnnotationTest.java | 11191 ++++ .../regression/NullAnnotationTests18.java | 544 + .../regression/NullAnnotationTests9.java | 434 + .../compiler/regression/NullChecksTests.java | 447 + .../regression/NullReferenceImplTests.java | 1817 + .../NullReferenceImplTransformations.java | 3296 + .../regression/NullReferenceTest.java | 18488 ++++++ .../regression/NullReferenceTestAsserts.java | 1381 + .../regression/NullTypeAnnotationTest.java | 18296 ++++++ .../compiler/regression/NumericTest.java | 148 + .../regression/OverloadResolutionTest8.java | 2725 + .../regression/PackageBindingTest.java | 167 + .../regression/PatternMatching16Test.java | 4090 ++ .../regression/PolymorphicSignatureTest.java | 106 + .../regression/PreviewFeatureTest.java | 269 + .../regression/ProblemConstructorTest.java | 512 + .../regression/ProblemTypeAndMethodTest.java | 8786 +++ .../regression/ProgrammingProblemsTest.java | 3325 + .../regression/PublicScannerTest.java | 331 + .../RecordsRestrictedClassTest.java | 9135 +++ .../regression/RegressionTestSetup.java | 43 + .../regression/RepeatableAnnotationTest.java | 1564 + .../tests/compiler/regression/Requestor.java | 68 + .../regression/ResourceLeakTests.java | 6998 ++ .../regression/RunComparableTests.java | 77 + .../compiler/regression/RuntimeTests.java | 529 + .../compiler/regression/ScannerTest.java | 1793 + .../compiler/regression/SealedTypesTests.java | 5765 ++ .../regression/SerialVersionUIDTests.java | 358 + .../regression/SerializableLambdaTest.java | 2421 + .../regression/StackMapAttributeTest.java | 8928 +++ .../compiler/regression/StaticImportTest.java | 3421 + .../compiler/regression/SuperTypeTest.java | 650 + .../regression/SuppressWarningsTest.java | 113 + .../SwitchExpressionsYieldTest.java | 6170 ++ .../regression/SwitchPatternTest.java | 5288 ++ .../tests/compiler/regression/SwitchTest.java | 3193 + .../tests/compiler/regression/TestAll.java | 450 + .../compiler/regression/TextBlockTest.java | 1621 + .../regression/TryStatement17Test.java | 1328 + .../regression/TryStatement9Test.java | 747 + .../compiler/regression/TryStatementTest.java | 6267 ++ .../TryWithResourcesStatementTest.java | 4326 ++ .../regression/TypeAnnotationTest.java | 6967 ++ .../regression/UnderscoresInLiteralsTest.java | 443 + .../compiler/regression/Unicode10Test.java | 45 + .../compiler/regression/Unicode11Test.java | 65 + .../compiler/regression/Unicode12_1Test.java | 65 + .../compiler/regression/Unicode13Test.java | 58 + .../compiler/regression/Unicode18Test.java | 126 + .../compiler/regression/Unicode9Test.java | 45 + .../regression/UnnamedModuleTest.java | 69 + .../tests/compiler/regression/UtilTest.java | 749 + .../regression/ValueBasedAnnotationTests.java | 133 + .../compiler/regression/VarargsTest.java | 3649 ++ .../tests/compiler/regression/XLargeTest.java | 20720 ++++++ .../compiler/regression/XLargeTest2.java | 425 + .../compiler/util/HashtableOfObjectTest.java | 223 + .../tests/dom/StandAloneASTParserTest.java | 1884 + .../jdt/core/tests/eval/CodeSnippetTest.java | 1049 + .../core/tests/eval/DebugEvaluationSetup.java | 193 + .../core/tests/eval/DebugEvaluationTest.java | 3114 + .../eval/EvaluationContextWrapperTest.java | 350 + .../jdt/core/tests/eval/EvaluationSetup.java | 152 + .../jdt/core/tests/eval/EvaluationTest.java | 572 + .../jdt/core/tests/eval/JDIStackFrame.java | 382 + .../tests/eval/NegativeCodeSnippetTest.java | 370 + .../core/tests/eval/NegativeVariableTest.java | 151 + .../eval/SanityTestEvaluationContext.java | 239 + .../eval/SanityTestEvaluationResult.java | 118 + .../tests/eval/SimpleCodeSnippetTest.java | 45 + .../jdt/core/tests/eval/SimpleTest.java | 318 + .../core/tests/eval/SimpleVariableTest.java | 40 + .../eclipse/jdt/core/tests/eval/TestAll.java | 41 + .../jdt/core/tests/eval/VariableTest.java | 299 + .../eval/target/CodeSnippetClassLoader.java | 123 + .../tests/eval/target/CodeSnippetRunner.java | 518 + .../core/tests/eval/target/IDEInterface.java | 159 + .../junit/extension/PerformanceTestSuite.java | 101 + .../junit/extension/StopableTestCase.java | 24 + .../core/tests/junit/extension/TestCase.java | 991 + .../tests/junit/extension/TestListener.java | 30 + .../tests/junit/extension/TestResult.java | 69 + .../core/tests/runtime/AbstractReader.java | 58 + .../jdt/core/tests/runtime/DRLVMLauncher.java | 148 + .../jdt/core/tests/runtime/J9VMLauncher.java | 292 + .../core/tests/runtime/J9VirtualMachine.java | 65 + .../core/tests/runtime/JRockitVMLauncher.java | 200 + .../core/tests/runtime/LocalVMLauncher.java | 476 + .../tests/runtime/LocalVirtualMachine.java | 206 + .../jdt/core/tests/runtime/MacVMLauncher.java | 141 + .../core/tests/runtime/NullConsoleReader.java | 46 + .../tests/runtime/ProxyConsoleReader.java | 73 + .../core/tests/runtime/RuntimeConstants.java | 24 + .../tests/runtime/SideCarJ9VMLauncher.java | 142 + .../core/tests/runtime/SideCarVMLauncher.java | 139 + .../tests/runtime/StandardVMLauncher.java | 225 + .../core/tests/runtime/TargetException.java | 37 + .../core/tests/runtime/TargetInterface.java | 200 + .../jdt/core/tests/runtime/VMInputStream.java | 122 + .../core/tests/util/AbstractCompilerTest.java | 754 + .../core/tests/util/CompilerTestSetup.java | 72 + .../jdt/core/tests/util/TestVerifier.java | 686 + .../org/eclipse/jdt/core/tests/util/Util.java | 1607 + .../jdt/core/tests/util/VerifyTests.java | 125 + .../tests/util/ZipEntryStorageException.java | 12 + .../test.xml | 94 + .../Bug422832ClassFile/aspose.pdf.jar | Bin 0 -> 513 bytes .../workspace/ParameterNames$1.class | Bin 0 -> 907 bytes .../workspace/ParameterNames$1Local.class | Bin 0 -> 675 bytes .../workspace/ParameterNames.class | Bin 0 -> 955 bytes .../workspace/Test372011.jar | Bin 0 -> 4666 bytes .../workspace/Test374129.jar | Bin 0 -> 3701 bytes .../workspace/Test374129_1.8.jar | Bin 0 -> 3674 bytes .../workspace/Test380112.jar | Bin 0 -> 1258 bytes .../workspace/Test388281.jar | Bin 0 -> 3222 bytes .../workspace/Test388281_1.8.jar | Bin 0 -> 3213 bytes .../workspace/Test454182.jar | Bin 0 -> 1113 bytes .../workspace/Test548596.jar | Bin 0 -> 2105 bytes .../workspace/Test571363.jar | Bin 0 -> 1250 bytes .../workspace/TestBootstrapMethodAtt.class | Bin 0 -> 324 bytes .../workspace/bug492322-compiled-with-4.6.jar | Bin 0 -> 8589 bytes .../workspace/multi.jar | Bin 0 -> 6523 bytes .../e425/org.eclipse.jdt.core/.classpath | 20 + .../e425/org.eclipse.jdt.core/.gitignore | 3 + jdt-patch/e425/org.eclipse.jdt.core/.options | 102 + jdt-patch/e425/org.eclipse.jdt.core/.project | 34 + .../.settings/.api_filters | 267 + .../org.eclipse.core.resources.prefs | 3 + .../.settings/org.eclipse.core.runtime.prefs | 2 + .../.settings/org.eclipse.jdt.core.prefs | 395 + .../.settings/org.eclipse.jdt.ui.prefs | 113 + .../.settings/org.eclipse.pde.api.tools.prefs | 93 + .../.settings/org.eclipse.pde.prefs | 35 + .../org.eclipse.jdt.core/META-INF/MANIFEST.MF | 73 + .../org.eclipse.jdt.core/META-INF/eclipse.inf | 2 + .../e425/org.eclipse.jdt.core/about.html | 42 + .../antadapter/META-INF/eclipse.inf | 2 + .../org/eclipse/jdt/core/BuildJarIndex.java | 66 + .../jdt/core/CheckDebugAttributes.java | 107 + .../eclipse/jdt/core/JDTCompilerAdapter.java | 587 + .../antadapter/AntAdapterMessages.java | 57 + .../internal/antadapter/messages.properties | 28 + .../core/compiler/batch/BatchCompiler.java | 88 + .../jdt/core/compiler/batch/package.html | 16 + .../internal/compiler/batch/BasicModule.java | 252 + .../batch/BatchCompilerRequestor.java | 51 + .../compiler/batch/ClasspathDirectory.java | 392 + .../internal/compiler/batch/ClasspathJar.java | 336 + .../compiler/batch/ClasspathJep247.java | 308 + .../compiler/batch/ClasspathJep247Jdk12.java | 316 + .../compiler/batch/ClasspathJmod.java | 189 + .../internal/compiler/batch/ClasspathJrt.java | 410 + .../compiler/batch/ClasspathLocation.java | 199 + .../batch/ClasspathMultiReleaseJar.java | 166 + .../compiler/batch/ClasspathSourceJar.java | 72 + .../compiler/batch/CompilationUnit.java | 151 + .../internal/compiler/batch/FileFinder.java | 60 + .../internal/compiler/batch/FileSystem.java | 742 + .../jdt/internal/compiler/batch/Main.java | 5675 ++ .../internal/compiler/batch/ModuleFinder.java | 295 + .../compiler/batch/messages.properties | 512 + .../org.eclipse.jdt.core/build.properties | 49 + .../codeassist/CompletionElementNotifier.java | 228 + .../internal/codeassist/CompletionEngine.java | 14521 +++++ .../CompletionRequestorWrapper.java | 345 + .../CompletionUnitStructureRequestor.java | 257 + .../IExtendedCompletionRequestor.java | 28 + .../internal/codeassist/ISearchRequestor.java | 98 + .../codeassist/ISelectionRequestor.java | 277 + .../codeassist/InternalCompletionContext.java | 283 + .../InternalCompletionProposal.java | 1203 + .../InternalExtendedCompletionContext.java | 983 + .../codeassist/MissingTypesGuesser.java | 633 + .../codeassist/RelevanceConstants.java | 65 + .../internal/codeassist/SelectionEngine.java | 2067 + .../codeassist/ThrownExceptionFinder.java | 237 + .../UnresolvedReferenceNameFinder.java | 575 + ...tNodeParentAnnotationArrayInitializer.java | 39 + .../complete/CompletionJavadoc.java | 313 + .../complete/CompletionJavadocParser.java | 1068 + .../complete/CompletionNodeDetector.java | 548 + .../complete/CompletionNodeFound.java | 47 + ...CompletionOnAnnotationMemberValuePair.java | 74 + .../CompletionOnAnnotationOfType.java | 39 + .../complete/CompletionOnArgumentName.java | 71 + .../complete/CompletionOnBreakStatement.java | 49 + .../CompletionOnClassLiteralAccess.java | 66 + .../CompletionOnContinueStatement.java | 49 + .../CompletionOnExplicitConstructorCall.java | 88 + .../complete/CompletionOnExportReference.java | 51 + .../complete/CompletionOnFieldName.java | 48 + .../complete/CompletionOnFieldType.java | 59 + .../complete/CompletionOnImportReference.java | 55 + .../complete/CompletionOnJavadoc.java | 40 + ...mpletionOnJavadocAllocationExpression.java | 98 + .../CompletionOnJavadocFieldReference.java | 135 + .../CompletionOnJavadocMessageSend.java | 97 + .../CompletionOnJavadocModuleReference.java | 94 + ...CompletionOnJavadocParamNameReference.java | 54 + ...letionOnJavadocQualifiedTypeReference.java | 94 + ...ompletionOnJavadocSingleTypeReference.java | 90 + .../complete/CompletionOnJavadocTag.java | 197 + ...CompletionOnJavadocTypeParamReference.java | 55 + .../complete/CompletionOnKeyword.java | 20 + .../complete/CompletionOnKeyword1.java | 51 + .../complete/CompletionOnKeyword2.java | 40 + .../complete/CompletionOnKeyword3.java | 52 + .../complete/CompletionOnKeywordModule2.java | 40 + .../CompletionOnKeywordModuleDeclaration.java | 40 + .../CompletionOnKeywordModuleInfo.java | 47 + .../complete/CompletionOnLocalName.java | 57 + .../CompletionOnMarkerAnnotationName.java | 41 + .../complete/CompletionOnMemberAccess.java | 87 + .../complete/CompletionOnMemberValueName.java | 43 + .../complete/CompletionOnMessageSend.java | 94 + .../complete/CompletionOnMessageSendName.java | 79 + .../complete/CompletionOnMethodName.java | 58 + .../CompletionOnMethodReturnType.java | 38 + .../CompletionOnMethodTypeParameter.java | 49 + .../CompletionOnModuleDeclaration.java | 26 + .../complete/CompletionOnModuleReference.java | 50 + .../CompletionOnPackageReference.java | 55 + ...ompletionOnPackageVisibilityReference.java | 55 + ...OnParameterizedQualifiedTypeReference.java | 143 + ...ImplementationsQualifiedTypeReference.java | 24 + ...desImplementationsSingleTypeReference.java | 21 + ...videsInterfacesQualifiedTypeReference.java | 24 + ...ProvidesInterfacesSingleTypeReference.java | 21 + ...letionOnQualifiedAllocationExpression.java | 104 + .../CompletionOnQualifiedNameReference.java | 83 + .../CompletionOnQualifiedTypeReference.java | 120 + .../CompletionOnReferenceExpressionName.java | 81 + .../CompletionOnSingleNameReference.java | 72 + .../CompletionOnSingleTypeReference.java | 125 + .../complete/CompletionOnStringLiteral.java | 68 + ...ompletionOnUsesQualifiedTypeReference.java | 23 + .../CompletionOnUsesSingleTypeReference.java | 21 + .../codeassist/complete/CompletionParser.java | 6396 ++ .../complete/CompletionScanner.java | 1080 + .../complete/InvalidCursorLocation.java | 35 + .../codeassist/impl/AssistAnnotation.java | 35 + .../impl/AssistCompilationUnit.java | 64 + .../impl/AssistImportContainer.java | 41 + .../impl/AssistImportDeclaration.java | 35 + .../codeassist/impl/AssistInitializer.java | 45 + .../codeassist/impl/AssistOptions.java | 284 + .../impl/AssistPackageDeclaration.java | 41 + .../codeassist/impl/AssistParser.java | 2609 + .../codeassist/impl/AssistSourceField.java | 87 + .../codeassist/impl/AssistSourceMethod.java | 93 + .../codeassist/impl/AssistSourceType.java | 124 + .../codeassist/impl/AssistTypeParameter.java | 35 + .../jdt/internal/codeassist/impl/Engine.java | 413 + .../internal/codeassist/impl/Keywords.java | 74 + .../impl/RestrictedIdentifiers.java | 24 + .../codeassist/select/SelectionJavadoc.java | 147 + .../select/SelectionJavadocParser.java | 216 + .../codeassist/select/SelectionNodeFound.java | 34 + .../select/SelectionOnArgumentName.java | 67 + .../SelectionOnExplicitConstructorCall.java | 78 + .../select/SelectionOnFieldReference.java | 69 + .../select/SelectionOnFieldType.java | 32 + .../select/SelectionOnImportReference.java | 52 + .../select/SelectionOnLambdaExpression.java | 51 + .../select/SelectionOnLocalName.java | 71 + .../select/SelectionOnMessageSend.java | 120 + .../select/SelectionOnModuleDeclaration.java | 34 + .../select/SelectionOnModuleReference.java | 47 + .../SelectionOnNameOfMemberValuePair.java | 45 + .../select/SelectionOnPackageReference.java | 51 + ...SelectionOnPackageVisibilityReference.java | 47 + ...OnParameterizedQualifiedTypeReference.java | 84 + ...ionOnParameterizedSingleTypeReference.java | 56 + ...ectionOnQualifiedAllocationExpression.java | 115 + .../SelectionOnQualifiedNameReference.java | 93 + .../SelectionOnQualifiedSuperReference.java | 64 + .../SelectionOnQualifiedTypeReference.java | 79 + .../SelectionOnReferenceExpression.java | 37 + .../SelectionOnReferenceExpressionName.java | 60 + .../SelectionOnSingleNameReference.java | 88 + .../SelectionOnSingleTypeReference.java | 80 + .../select/SelectionOnSuperReference.java | 63 + .../codeassist/select/SelectionParser.java | 1786 + .../codeassist/select/SelectionScanner.java | 77 + .../jdt/core/compiler/CategorizedProblem.java | 179 + .../jdt/core/compiler/CharOperation.java | 4401 ++ .../core/compiler/CompilationProgress.java | 90 + .../eclipse/jdt/core/compiler/IProblem.java | 2505 + .../core/compiler/InvalidInputException.java | 41 + .../jdt/core/compiler/SubwordMatcher.java | 160 + .../eclipse/jdt/core/compiler/package.html | 17 + .../jdt/internal/compiler/ASTVisitor.java | 1062 + .../AbstractAnnotationProcessorManager.java | 106 + .../jdt/internal/compiler/ClassFile.java | 7729 +++ .../jdt/internal/compiler/ClassFilePool.java | 75 + .../internal/compiler/CompilationResult.java | 478 + .../jdt/internal/compiler/Compiler.java | 1134 + .../DefaultErrorHandlingPolicies.java | 122 + .../internal/compiler/GenericAstVisitor.java | 711 + .../internal/compiler/ICompilerRequestor.java | 25 + .../internal/compiler/IDebugRequestor.java | 45 + .../compiler/IErrorHandlingPolicy.java | 33 + .../internal/compiler/IProblemFactory.java | 87 + .../internal/compiler/ProcessTaskManager.java | 179 + .../jdt/internal/compiler/ReadManager.java | 184 + .../compiler/ast/AND_AND_Expression.java | 322 + .../jdt/internal/compiler/ast/ASTNode.java | 1471 + .../ast/AbstractMethodDeclaration.java | 714 + .../ast/AbstractVariableDeclaration.java | 147 + .../compiler/ast/AllocationExpression.java | 836 + .../jdt/internal/compiler/ast/Annotation.java | 1498 + .../ast/AnnotationMethodDeclaration.java | 179 + .../jdt/internal/compiler/ast/Argument.java | 292 + .../ast/ArrayAllocationExpression.java | 250 + .../compiler/ast/ArrayInitializer.java | 260 + .../ast/ArrayQualifiedTypeReference.java | 202 + .../internal/compiler/ast/ArrayReference.java | 244 + .../compiler/ast/ArrayTypeReference.java | 301 + .../compiler/ast/AssertStatement.java | 224 + .../jdt/internal/compiler/ast/Assignment.java | 286 + .../compiler/ast/BinaryExpression.java | 1949 + .../jdt/internal/compiler/ast/Block.java | 195 + .../compiler/ast/BranchStatement.java | 88 + .../internal/compiler/ast/BreakStatement.java | 125 + .../internal/compiler/ast/CaseStatement.java | 542 + .../internal/compiler/ast/CastExpression.java | 751 + .../internal/compiler/ast/CharLiteral.java | 115 + .../compiler/ast/ClassLiteralAccess.java | 140 + .../jdt/internal/compiler/ast/Clinit.java | 423 + .../ast/CombinedBinaryExpression.java | 415 + .../ast/CompactConstructorDeclaration.java | 94 + .../ast/CompilationUnitDeclaration.java | 864 + .../compiler/ast/CompoundAssignment.java | 230 + .../compiler/ast/ConditionalExpression.java | 902 + .../compiler/ast/ConstructorDeclaration.java | 717 + .../compiler/ast/ContainerAnnotation.java | 92 + .../compiler/ast/ContinueStatement.java | 127 + .../internal/compiler/ast/DoStatement.java | 305 + .../internal/compiler/ast/DoubleLiteral.java | 131 + .../internal/compiler/ast/EmptyStatement.java | 73 + .../compiler/ast/EqualExpression.java | 997 + .../compiler/ast/ExplicitConstructorCall.java | 565 + .../compiler/ast/ExportsStatement.java | 35 + .../jdt/internal/compiler/ast/Expression.java | 1374 + .../compiler/ast/ExpressionContext.java | 84 + .../compiler/ast/ExtendedStringLiteral.java | 86 + .../compiler/ast/FakeDefaultLiteral.java | 50 + .../compiler/ast/FakedTrackingVariable.java | 1175 + .../internal/compiler/ast/FalseLiteral.java | 81 + .../compiler/ast/FieldDeclaration.java | 385 + .../internal/compiler/ast/FieldReference.java | 797 + .../internal/compiler/ast/FloatLiteral.java | 132 + .../internal/compiler/ast/ForStatement.java | 505 + .../compiler/ast/ForeachStatement.java | 713 + .../compiler/ast/FunctionalExpression.java | 394 + .../internal/compiler/ast/GuardedPattern.java | 160 + .../compiler/ast/IJavadocTypeReference.java | 27 + .../compiler/ast/IPolyExpression.java | 68 + .../internal/compiler/ast/IfStatement.java | 356 + .../compiler/ast/ImportReference.java | 107 + .../internal/compiler/ast/Initializer.java | 163 + .../compiler/ast/InstanceOfExpression.java | 393 + .../jdt/internal/compiler/ast/IntLiteral.java | 183 + .../compiler/ast/IntLiteralMinValue.java | 29 + .../ast/IntersectionCastTypeReference.java | 195 + .../jdt/internal/compiler/ast/Invocation.java | 54 + .../jdt/internal/compiler/ast/Javadoc.java | 1275 + .../ast/JavadocAllocationExpression.java | 203 + .../ast/JavadocArgumentExpression.java | 136 + .../JavadocArrayQualifiedTypeReference.java | 56 + .../ast/JavadocArraySingleTypeReference.java | 54 + .../compiler/ast/JavadocFieldReference.java | 166 + .../ast/JavadocImplicitTypeReference.java | 145 + .../compiler/ast/JavadocMessageSend.java | 249 + .../compiler/ast/JavadocModuleReference.java | 194 + .../ast/JavadocQualifiedTypeReference.java | 140 + .../compiler/ast/JavadocReturnStatement.java | 69 + .../ast/JavadocSingleNameReference.java | 77 + .../ast/JavadocSingleTypeReference.java | 160 + .../compiler/ast/LabeledStatement.java | 177 + .../compiler/ast/LambdaExpression.java | 1541 + .../jdt/internal/compiler/ast/Literal.java | 63 + .../compiler/ast/LocalDeclaration.java | 510 + .../internal/compiler/ast/LongLiteral.java | 171 + .../compiler/ast/LongLiteralMinValue.java | 29 + .../internal/compiler/ast/MagicLiteral.java | 34 + .../compiler/ast/MarkerAnnotation.java | 59 + .../compiler/ast/MemberValuePair.java | 322 + .../internal/compiler/ast/MessageSend.java | 1248 + .../compiler/ast/MethodDeclaration.java | 446 + .../compiler/ast/ModuleDeclaration.java | 470 + .../compiler/ast/ModuleReference.java | 49 + .../compiler/ast/ModuleStatement.java | 26 + .../internal/compiler/ast/NameReference.java | 136 + .../compiler/ast/NormalAnnotation.java | 95 + .../compiler/ast/NullAnnotationMatching.java | 807 + .../internal/compiler/ast/NullLiteral.java | 81 + .../internal/compiler/ast/NumberLiteral.java | 96 + .../compiler/ast/OR_OR_Expression.java | 337 + .../internal/compiler/ast/OpensStatement.java | 45 + .../compiler/ast/OperatorExpression.java | 1571 + .../internal/compiler/ast/OperatorIds.java | 46 + .../ast/PackageVisibilityStatement.java | 85 + .../ParameterizedQualifiedTypeReference.java | 542 + .../ast/ParameterizedSingleTypeReference.java | 456 + .../jdt/internal/compiler/ast/Pattern.java | 48 + .../compiler/ast/PostfixExpression.java | 81 + .../compiler/ast/PrefixExpression.java | 66 + .../compiler/ast/ProvidesStatement.java | 136 + .../ast/QualifiedAllocationExpression.java | 716 + .../compiler/ast/QualifiedNameReference.java | 1207 + .../compiler/ast/QualifiedSuperReference.java | 135 + .../compiler/ast/QualifiedThisReference.java | 180 + .../compiler/ast/QualifiedTypeReference.java | 251 + .../jdt/internal/compiler/ast/Receiver.java | 45 + .../compiler/ast/RecordComponent.java | 157 + .../jdt/internal/compiler/ast/Reference.java | 240 + .../compiler/ast/ReferenceExpression.java | 1316 + .../compiler/ast/RequiresStatement.java | 62 + .../compiler/ast/ReturnStatement.java | 394 + .../compiler/ast/SingleMemberAnnotation.java | 91 + .../compiler/ast/SingleNameReference.java | 1115 + .../compiler/ast/SingleTypeReference.java | 158 + .../jdt/internal/compiler/ast/Statement.java | 581 + .../internal/compiler/ast/StringLiteral.java | 105 + .../ast/StringLiteralConcatenation.java | 86 + .../compiler/ast/SubRoutineStatement.java | 87 + .../internal/compiler/ast/SuperReference.java | 85 + .../compiler/ast/SwitchExpression.java | 828 + .../compiler/ast/SwitchStatement.java | 1352 + .../compiler/ast/SynchronizedStatement.java | 255 + .../jdt/internal/compiler/ast/TextBlock.java | 20 + .../internal/compiler/ast/ThisReference.java | 161 + .../internal/compiler/ast/ThrowStatement.java | 108 + .../internal/compiler/ast/TrueLiteral.java | 82 + .../internal/compiler/ast/TryStatement.java | 1398 + .../compiler/ast/TypeDeclaration.java | 1893 + .../internal/compiler/ast/TypeParameter.java | 238 + .../internal/compiler/ast/TypePattern.java | 148 + .../internal/compiler/ast/TypeReference.java | 806 + .../compiler/ast/UnaryExpression.java | 355 + .../compiler/ast/UnionTypeReference.java | 154 + .../compiler/ast/UnlikelyArgumentCheck.java | 190 + .../internal/compiler/ast/UsesStatement.java | 32 + .../internal/compiler/ast/WhileStatement.java | 358 + .../jdt/internal/compiler/ast/Wildcard.java | 175 + .../internal/compiler/ast/YieldStatement.java | 287 + .../compiler/classfmt/AnnotationInfo.java | 467 + .../classfmt/AnnotationMethodInfo.java | 120 + .../AnnotationMethodInfoWithAnnotations.java | 43 + ...notationMethodInfoWithTypeAnnotations.java | 44 + .../classfmt/BinaryTypeFormatter.java | 139 + .../compiler/classfmt/ClassFileConstants.java | 222 + .../compiler/classfmt/ClassFileReader.java | 1464 + .../compiler/classfmt/ClassFileStruct.java | 87 + .../classfmt/ClassFormatException.java | 143 + .../classfmt/ComponentInfoWithAnnotation.java | 60 + .../ComponentInfoWithTypeAnnotation.java | 55 + .../classfmt/ElementValuePairInfo.java | 91 + .../classfmt/ExternalAnnotationDecorator.java | 312 + .../classfmt/ExternalAnnotationProvider.java | 718 + .../internal/compiler/classfmt/FieldInfo.java | 453 + .../classfmt/FieldInfoWithAnnotation.java | 66 + .../classfmt/FieldInfoWithTypeAnnotation.java | 57 + .../compiler/classfmt/InnerClassInfo.java | 128 + .../compiler/classfmt/JavaBinaryNames.java | 17 + .../compiler/classfmt/MethodInfo.java | 554 + .../classfmt/MethodInfoWithAnnotations.java | 52 + .../MethodInfoWithParameterAnnotations.java | 71 + .../MethodInfoWithTypeAnnotations.java | 45 + .../compiler/classfmt/ModuleInfo.java | 395 + ...nNullDefaultAwareTypeAnnotationWalker.java | 281 + .../classfmt/RecordComponentInfo.java | 282 + .../compiler/classfmt/TypeAnnotationInfo.java | 222 + .../classfmt/TypeAnnotationWalker.java | 276 + .../compiler/codegen/AnnotationContext.java | 60 + .../AnnotationTargetTypeConstants.java | 56 + .../codegen/AttributeNamesConstants.java | 59 + .../compiler/codegen/BranchLabel.java | 264 + .../compiler/codegen/CachedIndexEntry.java | 24 + .../internal/compiler/codegen/CaseLabel.java | 92 + .../compiler/codegen/CharArrayCache.java | 214 + .../internal/compiler/codegen/CodeStream.java | 7757 +++ .../compiler/codegen/ConstantPool.java | 1283 + .../compiler/codegen/DoubleCache.java | 152 + .../compiler/codegen/ExceptionLabel.java | 102 + .../internal/compiler/codegen/FloatCache.java | 152 + .../compiler/codegen/IntegerCache.java | 174 + .../jdt/internal/compiler/codegen/Label.java | 36 + .../internal/compiler/codegen/LongCache.java | 174 + .../codegen/MultiCatchExceptionLabel.java | 66 + .../compiler/codegen/ObjectCache.java | 162 + .../internal/compiler/codegen/Opcodes.java | 223 + .../compiler/codegen/StackMapFrame.java | 417 + .../codegen/StackMapFrameCodeStream.java | 522 + .../codegen/TypeAnnotationCodeStream.java | 172 + .../codegen/VerificationTypeInfo.java | 251 + .../compiler/env/AccessRestriction.java | 39 + .../jdt/internal/compiler/env/AccessRule.java | 77 + .../internal/compiler/env/AccessRuleSet.java | 140 + .../compiler/env/AutomaticModuleNaming.java | 151 + .../internal/compiler/env/ClassSignature.java | 70 + .../compiler/env/EnumConstantSignature.java | 83 + .../compiler/env/IBinaryAnnotation.java | 45 + .../compiler/env/IBinaryElementValuePair.java | 34 + .../internal/compiler/env/IBinaryField.java | 64 + .../internal/compiler/env/IBinaryMethod.java | 104 + .../internal/compiler/env/IBinaryModule.java | 20 + .../compiler/env/IBinaryNestedType.java | 41 + .../internal/compiler/env/IBinaryType.java | 203 + .../compiler/env/IBinaryTypeAnnotation.java | 77 + .../compiler/env/ICompilationUnit.java | 83 + .../jdt/internal/compiler/env/IDependent.java | 47 + .../internal/compiler/env/IGenericField.java | 26 + .../internal/compiler/env/IGenericMethod.java | 32 + .../internal/compiler/env/IGenericType.java | 31 + .../jdt/internal/compiler/env/IModule.java | 146 + .../env/IModuleAwareNameEnvironment.java | 151 + .../compiler/env/IModulePathEntry.java | 93 + .../compiler/env/IMultiModuleEntry.java | 39 + .../compiler/env/INameEnvironment.java | 88 + .../env/INameEnvironmentExtension.java | 56 + .../compiler/env/IRecordComponent.java | 18 + .../internal/compiler/env/ISourceField.java | 50 + .../internal/compiler/env/ISourceImport.java | 35 + .../internal/compiler/env/ISourceMethod.java | 66 + .../internal/compiler/env/ISourceModule.java | 18 + .../internal/compiler/env/ISourceType.java | 109 + .../compiler/env/ITypeAnnotationWalker.java | 136 + .../compiler/env/IUpdatableModule.java | 171 + .../compiler/env/ModuleReferenceImpl.java | 44 + .../compiler/env/NameEnvironmentAnswer.java | 191 + .../compiler/env/PackageExportImpl.java | 45 + .../compiler/flow/ConditionalFlowInfo.java | 306 + .../flow/ExceptionHandlingFlowContext.java | 331 + .../flow/ExceptionInferenceFlowContext.java | 35 + .../flow/FieldInitsFakingFlowContext.java | 38 + .../compiler/flow/FinallyFlowContext.java | 508 + .../internal/compiler/flow/FlowContext.java | 1098 + .../jdt/internal/compiler/flow/FlowInfo.java | 692 + .../flow/InitializationFlowContext.java | 108 + .../flow/InsideSubRoutineFlowContext.java | 66 + .../compiler/flow/LabelFlowContext.java | 59 + .../compiler/flow/LoopingFlowContext.java | 803 + .../compiler/flow/SwitchFlowContext.java | 65 + .../compiler/flow/TryFlowContext.java | 49 + .../compiler/flow/UnconditionalFlowInfo.java | 2323 + .../compiler/impl/BooleanConstant.java | 71 + .../internal/compiler/impl/ByteConstant.java | 98 + .../internal/compiler/impl/CharConstant.java | 98 + .../compiler/impl/CompilerOptions.java | 2343 + .../internal/compiler/impl/CompilerStats.java | 46 + .../jdt/internal/compiler/impl/Constant.java | 1546 + .../compiler/impl/DoubleConstant.java | 100 + .../internal/compiler/impl/FloatConstant.java | 97 + .../compiler/impl/ITypeRequestor.java | 68 + .../internal/compiler/impl/IntConstant.java | 133 + .../internal/compiler/impl/IrritantSet.java | 324 + .../internal/compiler/impl/JavaFeature.java | 100 + .../internal/compiler/impl/LongConstant.java | 107 + .../compiler/impl/ReferenceContext.java | 40 + .../internal/compiler/impl/ShortConstant.java | 99 + .../compiler/impl/StringConstant.java | 75 + .../lookup/AnnotatableTypeSystem.java | 433 + .../compiler/lookup/AnnotationBinding.java | 324 + .../compiler/lookup/AnnotationHolder.java | 98 + .../compiler/lookup/ArrayBinding.java | 581 + .../compiler/lookup/BaseTypeBinding.java | 248 + .../compiler/lookup/BinaryModuleBinding.java | 257 + .../compiler/lookup/BinaryTypeBinding.java | 2625 + .../jdt/internal/compiler/lookup/Binding.java | 216 + .../internal/compiler/lookup/BlockScope.java | 1335 + .../internal/compiler/lookup/BoundSet.java | 1297 + .../compiler/lookup/CaptureBinding.java | 603 + .../compiler/lookup/CaptureBinding18.java | 371 + .../lookup/CatchParameterBinding.java | 44 + .../internal/compiler/lookup/ClassScope.java | 1791 + .../compiler/lookup/CompilationUnitScope.java | 1230 + .../lookup/ConstraintExceptionFormula.java | 168 + .../lookup/ConstraintExpressionFormula.java | 561 + .../compiler/lookup/ConstraintFormula.java | 68 + .../lookup/ConstraintTypeFormula.java | 435 + .../lookup/DelegateMethodBinding.java | 33 + .../compiler/lookup/ElementValuePair.java | 150 + .../compiler/lookup/ExtendedTagBits.java | 32 + .../ExternalAnnotationSuperimposer.java | 287 + .../lookup/ExtraCompilerModifiers.java | 60 + .../compiler/lookup/FieldBinding.java | 448 + .../IQualifiedTypeResolutionListener.java | 36 + .../ImplicitNullAnnotationVerifier.java | 622 + .../compiler/lookup/ImportBinding.java | 61 + .../lookup/ImportConflictBinding.java | 34 + .../compiler/lookup/InferenceContext.java | 142 + .../compiler/lookup/InferenceContext18.java | 1913 + .../lookup/InferenceFailureException.java | 29 + .../lookup/InferenceSubstitution.java | 163 + .../compiler/lookup/InferenceVariable.java | 238 + .../lookup/InnerEmulationDependency.java | 25 + .../lookup/IntersectionTypeBinding18.java | 376 + .../compiler/lookup/InvocationSite.java | 87 + .../lookup/LazilyResolvedMethodBinding.java | 76 + .../compiler/lookup/LocalTypeBinding.java | 328 + .../compiler/lookup/LocalVariableBinding.java | 350 + .../compiler/lookup/LookupEnvironment.java | 2354 + .../compiler/lookup/MemberTypeBinding.java | 100 + .../compiler/lookup/MethodBinding.java | 1501 + .../internal/compiler/lookup/MethodScope.java | 748 + .../compiler/lookup/MethodVerifier.java | 1049 + .../compiler/lookup/MethodVerifier15.java | 1047 + .../compiler/lookup/MissingTypeBinding.java | 94 + .../compiler/lookup/ModuleBinding.java | 912 + .../internal/compiler/lookup/ModuleScope.java | 38 + .../MostSpecificExceptionMethodBinding.java | 44 + .../compiler/lookup/NestedTypeBinding.java | 265 + .../compiler/lookup/NullTypeBinding.java | 39 + .../compiler/lookup/PackageBinding.java | 498 + .../ParameterNonNullDefaultProvider.java | 60 + .../lookup/ParameterizedFieldBinding.java | 68 + .../ParameterizedGenericMethodBinding.java | 854 + .../lookup/ParameterizedMethodBinding.java | 365 + .../lookup/ParameterizedTypeBinding.java | 1793 + .../compiler/lookup/PlainPackageBinding.java | 47 + ...PolyParameterizedGenericMethodBinding.java | 37 + .../compiler/lookup/PolyTypeBinding.java | 103 + .../lookup/PolymorphicMethodBinding.java | 89 + .../compiler/lookup/ProblemBinding.java | 61 + .../compiler/lookup/ProblemFieldBinding.java | 40 + .../compiler/lookup/ProblemMethodBinding.java | 94 + .../lookup/ProblemPackageBinding.java | 36 + .../compiler/lookup/ProblemReasons.java | 55 + .../lookup/ProblemReferenceBinding.java | 136 + .../compiler/lookup/RawTypeBinding.java | 337 + .../lookup/RecordComponentBinding.java | 132 + .../compiler/lookup/ReductionResult.java | 65 + .../compiler/lookup/ReferenceBinding.java | 2474 + .../lookup/ReferenceBindingSetWrapper.java | 58 + .../jdt/internal/compiler/lookup/Scope.java | 5543 ++ .../compiler/lookup/SignatureWrapper.java | 224 + .../lookup/SortedCompoundNameVector.java | 63 + .../lookup/SortedSimpleNameVector.java | 62 + .../compiler/lookup/SourceModuleBinding.java | 167 + .../compiler/lookup/SourceTypeBinding.java | 3707 ++ .../lookup/SourceTypeCollisionException.java | 22 + .../compiler/lookup/SplitPackageBinding.java | 292 + .../compiler/lookup/Substitution.java | 60 + .../lookup/SyntheticArgumentBinding.java | 62 + .../lookup/SyntheticFactoryMethodBinding.java | 60 + .../lookup/SyntheticFieldBinding.java | 27 + .../lookup/SyntheticMethodBinding.java | 703 + .../jdt/internal/compiler/lookup/TagBits.java | 198 + .../internal/compiler/lookup/TypeBinding.java | 1768 + .../compiler/lookup/TypeBindingVisitor.java | 158 + .../internal/compiler/lookup/TypeBound.java | 94 + .../compiler/lookup/TypeConstants.java | 568 + .../jdt/internal/compiler/lookup/TypeIds.java | 294 + .../internal/compiler/lookup/TypeSystem.java | 643 + .../compiler/lookup/TypeVariableBinding.java | 1162 + .../lookup/UnresolvedAnnotationBinding.java | 84 + .../lookup/UnresolvedReferenceBinding.java | 170 + .../compiler/lookup/VariableBinding.java | 107 + .../compiler/lookup/VoidTypeBinding.java | 39 + .../compiler/lookup/WildcardBinding.java | 1090 + .../jdt/internal/compiler/messages.properties | 75 + .../parser/AbstractCommentParser.java | 3245 + .../compiler/parser/ConflictedParser.java | 31 + .../compiler/parser/JavadocParser.java | 1291 + .../compiler/parser/JavadocScanner.java | 412 + .../compiler/parser/JavadocTagConstants.java | 446 + .../jdt/internal/compiler/parser/NLSTag.java | 34 + .../jdt/internal/compiler/parser/Parser.java | 14714 +++++ .../parser/ParserBasicInformation.java | 41 + .../compiler/parser/RecoveredAnnotation.java | 245 + .../compiler/parser/RecoveredBlock.java | 482 + .../compiler/parser/RecoveredElement.java | 381 + .../compiler/parser/RecoveredExport.java | 102 + .../parser/RecoveredExportsStatement.java | 28 + .../compiler/parser/RecoveredField.java | 359 + .../compiler/parser/RecoveredImport.java | 65 + .../compiler/parser/RecoveredInitializer.java | 365 + .../parser/RecoveredLocalVariable.java | 178 + .../compiler/parser/RecoveredMethod.java | 693 + .../compiler/parser/RecoveredModule.java | 290 + .../parser/RecoveredModuleReference.java | 63 + .../parser/RecoveredModuleStatement.java | 63 + .../parser/RecoveredOpensStatement.java | 28 + .../RecoveredPackageVisibilityStatement.java | 82 + .../parser/RecoveredProvidesStatement.java | 47 + .../parser/RecoveredRequiresStatement.java | 31 + .../compiler/parser/RecoveredStatement.java | 125 + .../compiler/parser/RecoveredType.java | 867 + .../parser/RecoveredTypeReference.java | 52 + .../compiler/parser/RecoveredUnit.java | 332 + .../parser/RecoveredUsesStatement.java | 35 + .../compiler/parser/RecoveryScanner.java | 296 + .../compiler/parser/RecoveryScannerData.java | 76 + .../jdt/internal/compiler/parser/Scanner.java | 5588 ++ .../compiler/parser/ScannerHelper.java | 650 + .../compiler/parser/TerminalTokens.java | 178 + .../parser/diagnose/DiagnoseParser.java | 2576 + .../compiler/parser/diagnose/LexStream.java | 303 + .../compiler/parser/diagnose/RangeUtil.java | 182 + .../jdt/internal/compiler/parser/parser1.rsc | Bin 0 -> 37202 bytes .../jdt/internal/compiler/parser/parser10.rsc | Bin 0 -> 638 bytes .../jdt/internal/compiler/parser/parser11.rsc | Bin 0 -> 638 bytes .../jdt/internal/compiler/parser/parser12.rsc | Bin 0 -> 638 bytes .../jdt/internal/compiler/parser/parser13.rsc | Bin 0 -> 638 bytes .../jdt/internal/compiler/parser/parser14.rsc | Bin 0 -> 2468 bytes .../jdt/internal/compiler/parser/parser15.rsc | Bin 0 -> 1654 bytes .../jdt/internal/compiler/parser/parser16.rsc | Bin 0 -> 2442 bytes .../jdt/internal/compiler/parser/parser17.rsc | Bin 0 -> 934 bytes .../jdt/internal/compiler/parser/parser18.rsc | Bin 0 -> 16502 bytes .../jdt/internal/compiler/parser/parser19.rsc | Bin 0 -> 638 bytes .../jdt/internal/compiler/parser/parser2.rsc | Bin 0 -> 35334 bytes .../jdt/internal/compiler/parser/parser20.rsc | Bin 0 -> 18630 bytes .../jdt/internal/compiler/parser/parser21.rsc | Bin 0 -> 7472 bytes .../jdt/internal/compiler/parser/parser22.rsc | Bin 0 -> 862 bytes .../jdt/internal/compiler/parser/parser23.rsc | Bin 0 -> 100 bytes .../jdt/internal/compiler/parser/parser24.rsc | Bin 0 -> 862 bytes .../jdt/internal/compiler/parser/parser3.rsc | Bin 0 -> 2442 bytes .../jdt/internal/compiler/parser/parser4.rsc | Bin 0 -> 3892 bytes .../jdt/internal/compiler/parser/parser5.rsc | Bin 0 -> 2442 bytes .../jdt/internal/compiler/parser/parser6.rsc | Bin 0 -> 1608 bytes .../jdt/internal/compiler/parser/parser7.rsc | Bin 0 -> 274 bytes .../jdt/internal/compiler/parser/parser8.rsc | Bin 0 -> 862 bytes .../jdt/internal/compiler/parser/parser9.rsc | Bin 0 -> 16408 bytes .../compiler/parser/readableNames.props | 400 + .../compiler/parser/unicode/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode10/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode11/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode12_1/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/part3.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode13/start3.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode6_2/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode7/start2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/part0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/part1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/part14.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/part2.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/start0.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/start1.rsc | Bin 0 -> 8192 bytes .../compiler/parser/unicode8/start2.rsc | Bin 0 -> 8192 bytes .../compiler/problem/AbortCompilation.java | 103 + .../problem/AbortCompilationUnit.java | 44 + .../compiler/problem/AbortMethod.java | 32 + .../internal/compiler/problem/AbortType.java | 32 + .../compiler/problem/DefaultProblem.java | 320 + .../problem/DefaultProblemFactory.java | 244 + .../compiler/problem/ProblemHandler.java | 270 + .../compiler/problem/ProblemReporter.java | 12444 ++++ .../compiler/problem/ProblemSeverities.java | 34 + .../compiler/problem/ShouldNotImplement.java | 27 + .../compiler/problem/messages.properties | 1155 + .../jdt/internal/compiler/util/CharArray.java | 65 + .../compiler/util/CharArrayHashMap.java | 68 + .../internal/compiler/util/CharArrayMap.java | 125 + .../compiler/util/CharArrayMapper.java | 50 + .../compiler/util/CharDeduplication.java | 284 + .../compiler/util/CharDelegateMap.java | 102 + .../jdt/internal/compiler/util/CtSym.java | 436 + .../jdt/internal/compiler/util/FloatUtil.java | 424 + .../compiler/util/GenericXMLWriter.java | 136 + .../internal/compiler/util/HashSetOfInt.java | 134 + .../compiler/util/HashtableOfInt.java | 102 + .../compiler/util/HashtableOfIntValues.java | 161 + .../compiler/util/HashtableOfInteger.java | 193 + .../compiler/util/HashtableOfLong.java | 105 + .../compiler/util/HashtableOfModule.java | 110 + .../compiler/util/HashtableOfObject.java | 244 + .../compiler/util/HashtableOfObjectToInt.java | 160 + .../util/HashtableOfObjectToIntArray.java | 173 + .../compiler/util/HashtableOfPackage.java | 34 + .../compiler/util/HashtableOfType.java | 134 + .../jdt/internal/compiler/util/JRTUtil.java | 658 + .../compiler/util/ManifestAnalyzer.java | 200 + .../jdt/internal/compiler/util/Messages.java | 253 + .../internal/compiler/util/ObjectVector.java | 156 + .../compiler/util/SimpleLookupTable.java | 172 + .../jdt/internal/compiler/util/SimpleSet.java | 146 + .../compiler/util/SimpleSetOfCharArray.java | 148 + .../compiler/util/SortedCharArrays.java | 88 + .../jdt/internal/compiler/util/Sorting.java | 124 + .../compiler/util/SuffixConstants.java | 33 + .../jdt/internal/compiler/util/Util.java | 1640 + .../e425/org.eclipse.jdt.core/component.xml | 340 + .../customBuildCallbacks.xml | 229 + .../dom/org/eclipse/jdt/core/dom/AST.java | 3836 ++ .../eclipse/jdt/core/dom/ASTConverter.java | 6799 ++ .../org/eclipse/jdt/core/dom/ASTMatcher.java | 3100 + .../dom/org/eclipse/jdt/core/dom/ASTNode.java | 3446 + .../org/eclipse/jdt/core/dom/ASTParser.java | 1552 + .../jdt/core/dom/ASTRecoveryPropagator.java | 462 + .../eclipse/jdt/core/dom/ASTRequestor.java | 120 + .../core/dom/ASTSyntaxErrorPropagator.java | 138 + .../org/eclipse/jdt/core/dom/ASTVisitor.java | 3441 + .../jdt/core/dom/AbstractTagElement.java | 241 + .../jdt/core/dom/AbstractTypeDeclaration.java | 258 + .../eclipse/jdt/core/dom/AnnotatableType.java | 106 + .../org/eclipse/jdt/core/dom/Annotation.java | 183 + .../jdt/core/dom/AnnotationBinding.java | 280 + .../core/dom/AnnotationTypeDeclaration.java | 246 + .../dom/AnnotationTypeMemberDeclaration.java | 389 + .../core/dom/AnonymousClassDeclaration.java | 178 + .../org/eclipse/jdt/core/dom/ArrayAccess.java | 259 + .../eclipse/jdt/core/dom/ArrayCreation.java | 296 + .../jdt/core/dom/ArrayInitializer.java | 149 + .../org/eclipse/jdt/core/dom/ArrayType.java | 411 + .../eclipse/jdt/core/dom/AssertStatement.java | 250 + .../org/eclipse/jdt/core/dom/Assignment.java | 428 + .../jdt/core/dom/BindingComparator.java | 330 + .../eclipse/jdt/core/dom/BindingResolver.java | 1112 + .../dom/org/eclipse/jdt/core/dom/Block.java | 157 + .../eclipse/jdt/core/dom/BlockComment.java | 120 + .../eclipse/jdt/core/dom/BodyDeclaration.java | 272 + .../eclipse/jdt/core/dom/BooleanLiteral.java | 166 + .../eclipse/jdt/core/dom/BreakStatement.java | 297 + .../jdt/core/dom/CaseDefaultExpression.java | 109 + .../eclipse/jdt/core/dom/CastExpression.java | 252 + .../org/eclipse/jdt/core/dom/CatchClause.java | 256 + .../jdt/core/dom/CharacterLiteral.java | 325 + .../core/dom/ChildListPropertyDescriptor.java | 102 + .../jdt/core/dom/ChildPropertyDescriptor.java | 117 + .../jdt/core/dom/ClassInstanceCreation.java | 565 + .../dom/org/eclipse/jdt/core/dom/Comment.java | 126 + .../eclipse/jdt/core/dom/CompilationUnit.java | 1175 + .../jdt/core/dom/CompilationUnitResolver.java | 1428 + .../jdt/core/dom/ConditionalExpression.java | 322 + .../jdt/core/dom/ConstructorInvocation.java | 234 + .../jdt/core/dom/ContinueStatement.java | 176 + .../jdt/core/dom/CreationReference.java | 222 + .../jdt/core/dom/DefaultASTVisitor.java | 930 + .../jdt/core/dom/DefaultBindingResolver.java | 2094 + .../jdt/core/dom/DefaultCommentMapper.java | 656 + .../jdt/core/dom/DefaultValuePairBinding.java | 64 + .../org/eclipse/jdt/core/dom/Dimension.java | 158 + .../org/eclipse/jdt/core/dom/DoStatement.java | 262 + .../jdt/core/dom/DocCommentParser.java | 1329 + .../eclipse/jdt/core/dom/EmptyStatement.java | 109 + .../jdt/core/dom/EnhancedForStatement.java | 318 + .../jdt/core/dom/EnumConstantDeclaration.java | 370 + .../eclipse/jdt/core/dom/EnumDeclaration.java | 309 + .../jdt/core/dom/ExportsDirective.java | 127 + .../org/eclipse/jdt/core/dom/Expression.java | 149 + .../core/dom/ExpressionMethodReference.java | 288 + .../jdt/core/dom/ExpressionStatement.java | 193 + .../org/eclipse/jdt/core/dom/FieldAccess.java | 301 + .../jdt/core/dom/FieldDeclaration.java | 350 + .../jdt/core/dom/FileASTRequestor.java | 111 + .../eclipse/jdt/core/dom/ForStatement.java | 346 + .../eclipse/jdt/core/dom/GuardedPattern.java | 259 + .../jdt/core/dom/IAnnotationBinding.java | 68 + .../org/eclipse/jdt/core/dom/IBinding.java | 371 + .../org/eclipse/jdt/core/dom/IDocElement.java | 38 + .../jdt/core/dom/IExtendedModifier.java | 47 + .../jdt/core/dom/IMemberValuePairBinding.java | 63 + .../eclipse/jdt/core/dom/IMethodBinding.java | 454 + .../eclipse/jdt/core/dom/IModuleBinding.java | 103 + .../eclipse/jdt/core/dom/IPackageBinding.java | 83 + .../eclipse/jdt/core/dom/ITypeBinding.java | 1090 + .../jdt/core/dom/IVariableBinding.java | 187 + .../org/eclipse/jdt/core/dom/IfStatement.java | 336 + .../jdt/core/dom/ImportDeclaration.java | 358 + .../eclipse/jdt/core/dom/InfixExpression.java | 523 + .../org/eclipse/jdt/core/dom/Initializer.java | 295 + .../jdt/core/dom/InstanceofExpression.java | 251 + .../jdt/core/dom/InternalASTRewrite.java | 290 + .../jdt/core/dom/IntersectionType.java | 157 + .../eclipse/jdt/core/dom/JavaDocRegion.java | 276 + .../dom/org/eclipse/jdt/core/dom/Javadoc.java | 306 + .../jdt/core/dom/LabeledStatement.java | 264 + .../jdt/core/dom/LambdaExpression.java | 318 + .../org/eclipse/jdt/core/dom/LineComment.java | 117 + .../jdt/core/dom/MarkerAnnotation.java | 144 + .../org/eclipse/jdt/core/dom/MemberRef.java | 260 + .../eclipse/jdt/core/dom/MemberValuePair.java | 268 + .../jdt/core/dom/MemberValuePairBinding.java | 254 + .../dom/org/eclipse/jdt/core/dom/Message.java | 137 + .../eclipse/jdt/core/dom/MethodBinding.java | 617 + .../jdt/core/dom/MethodDeclaration.java | 1246 + .../jdt/core/dom/MethodInvocation.java | 378 + .../org/eclipse/jdt/core/dom/MethodRef.java | 303 + .../jdt/core/dom/MethodRefParameter.java | 338 + .../eclipse/jdt/core/dom/MethodReference.java | 116 + .../org/eclipse/jdt/core/dom/Modifier.java | 813 + .../eclipse/jdt/core/dom/ModuleBinding.java | 241 + .../jdt/core/dom/ModuleDeclaration.java | 360 + .../eclipse/jdt/core/dom/ModuleDirective.java | 36 + .../eclipse/jdt/core/dom/ModuleModifier.java | 348 + .../jdt/core/dom/ModulePackageAccess.java | 207 + .../jdt/core/dom/ModuleQualifiedName.java | 252 + .../dom/org/eclipse/jdt/core/dom/Name.java | 120 + .../core/dom/NameEnvironmentWithProgress.java | 98 + .../jdt/core/dom/NameQualifiedType.java | 286 + .../jdt/core/dom/NodeEventHandler.java | 191 + .../org/eclipse/jdt/core/dom/NodeFinder.java | 218 + .../eclipse/jdt/core/dom/NodeSearcher.java | 108 + .../jdt/core/dom/NormalAnnotation.java | 184 + .../org/eclipse/jdt/core/dom/NullLiteral.java | 108 + .../org/eclipse/jdt/core/dom/NullPattern.java | 115 + .../eclipse/jdt/core/dom/NumberLiteral.java | 212 + .../eclipse/jdt/core/dom/OpensDirective.java | 126 + .../eclipse/jdt/core/dom/PackageBinding.java | 268 + .../jdt/core/dom/PackageDeclaration.java | 341 + .../jdt/core/dom/ParameterizedType.java | 239 + .../jdt/core/dom/ParenthesizedExpression.java | 188 + .../dom/org/eclipse/jdt/core/dom/Pattern.java | 72 + .../core/dom/PatternInstanceofExpression.java | 254 + .../jdt/core/dom/PostfixExpression.java | 317 + .../jdt/core/dom/PrefixExpression.java | 335 + .../eclipse/jdt/core/dom/PrimitiveType.java | 342 + .../jdt/core/dom/ProvidesDirective.java | 226 + .../eclipse/jdt/core/dom/QualifiedName.java | 267 + .../eclipse/jdt/core/dom/QualifiedType.java | 349 + .../jdt/core/dom/RecordDeclaration.java | 449 + .../jdt/core/dom/RecoveredPackageBinding.java | 134 + .../jdt/core/dom/RecoveredTypeBinding.java | 651 + .../core/dom/RecoveredVariableBinding.java | 154 + .../jdt/core/dom/RequiresDirective.java | 251 + .../eclipse/jdt/core/dom/ReturnStatement.java | 174 + .../org/eclipse/jdt/core/dom/SimpleName.java | 379 + .../core/dom/SimplePropertyDescriptor.java | 87 + .../org/eclipse/jdt/core/dom/SimpleType.java | 269 + .../jdt/core/dom/SingleMemberAnnotation.java | 212 + .../core/dom/SingleVariableDeclaration.java | 628 + .../org/eclipse/jdt/core/dom/Statement.java | 185 + .../eclipse/jdt/core/dom/StringLiteral.java | 282 + .../dom/StructuralPropertyDescriptor.java | 148 + .../core/dom/SuperConstructorInvocation.java | 297 + .../jdt/core/dom/SuperFieldAccess.java | 265 + .../jdt/core/dom/SuperMethodInvocation.java | 376 + .../jdt/core/dom/SuperMethodReference.java | 275 + .../org/eclipse/jdt/core/dom/SwitchCase.java | 341 + .../jdt/core/dom/SwitchExpression.java | 237 + .../eclipse/jdt/core/dom/SwitchStatement.java | 234 + .../jdt/core/dom/SynchronizedStatement.java | 254 + .../org/eclipse/jdt/core/dom/TagElement.java | 483 + .../org/eclipse/jdt/core/dom/TagProperty.java | 278 + .../org/eclipse/jdt/core/dom/TextBlock.java | 272 + .../org/eclipse/jdt/core/dom/TextElement.java | 186 + .../eclipse/jdt/core/dom/ThisExpression.java | 176 + .../eclipse/jdt/core/dom/ThrowStatement.java | 189 + .../eclipse/jdt/core/dom/TryStatement.java | 395 + .../dom/org/eclipse/jdt/core/dom/Type.java | 248 + .../org/eclipse/jdt/core/dom/TypeBinding.java | 1341 + .../eclipse/jdt/core/dom/TypeDeclaration.java | 887 + .../core/dom/TypeDeclarationStatement.java | 345 + .../org/eclipse/jdt/core/dom/TypeLiteral.java | 187 + .../jdt/core/dom/TypeMethodReference.java | 285 + .../eclipse/jdt/core/dom/TypeParameter.java | 310 + .../org/eclipse/jdt/core/dom/TypePattern.java | 218 + .../org/eclipse/jdt/core/dom/UnionType.java | 157 + .../eclipse/jdt/core/dom/UsesDirective.java | 190 + .../eclipse/jdt/core/dom/VariableBinding.java | 412 + .../jdt/core/dom/VariableDeclaration.java | 379 + .../dom/VariableDeclarationExpression.java | 412 + .../core/dom/VariableDeclarationFragment.java | 257 + .../dom/VariableDeclarationStatement.java | 414 + .../eclipse/jdt/core/dom/WhileStatement.java | 264 + .../eclipse/jdt/core/dom/WildcardType.java | 319 + .../eclipse/jdt/core/dom/YieldStatement.java | 222 + .../dom/org/eclipse/jdt/core/dom/package.html | 24 + .../jdt/core/dom/rewrite/ASTRewrite.java | 885 + .../dom/rewrite/ITrackedNodePosition.java | 46 + .../jdt/core/dom/rewrite/ImportRewrite.java | 1684 + .../jdt/core/dom/rewrite/ListRewrite.java | 438 + .../rewrite/TargetSourceRangeComputer.java | 137 + .../eclipse/jdt/core/dom/rewrite/package.html | 18 + .../internal/core/dom/NaiveASTFlattener.java | 2107 + .../core/dom/SourceRangeVerifier.java | 126 + .../core/dom/rewrite/ASTRewriteAnalyzer.java | 4645 ++ .../core/dom/rewrite/ASTRewriteFlattener.java | 1596 + .../core/dom/rewrite/ASTRewriteFormatter.java | 584 + .../dom/rewrite/LineCommentEndOffsets.java | 89 + .../core/dom/rewrite/LineInformation.java | 66 + .../core/dom/rewrite/ListRewriteEvent.java | 207 + .../core/dom/rewrite/NodeInfoStore.java | 169 + .../core/dom/rewrite/NodeRewriteEvent.java | 110 + .../core/dom/rewrite/RewriteEvent.java | 82 + .../core/dom/rewrite/RewriteEventStore.java | 896 + .../core/dom/rewrite/SourceModifier.java | 54 + .../core/dom/rewrite/TokenScanner.java | 241 + .../core/dom/rewrite/TrackedNodePosition.java | 59 + .../rewrite/imports/ConflictIdentifier.java | 163 + .../imports/ConflictingSimpleNameFinder.java | 37 + .../core/dom/rewrite/imports/ImportAdder.java | 26 + .../dom/rewrite/imports/ImportComment.java | 33 + .../dom/rewrite/imports/ImportComparator.java | 73 + .../imports/ImportDeclarationWriter.java | 52 + .../dom/rewrite/imports/ImportEditor.java | 541 + .../core/dom/rewrite/imports/ImportEntry.java | 41 + .../imports/ImportGroupComparator.java | 202 + .../core/dom/rewrite/imports/ImportName.java | 98 + .../imports/ImportRewriteAnalyzer.java | 688 + .../imports/ImportRewriteConfiguration.java | 291 + .../dom/rewrite/imports/ImportsDelta.java | 40 + .../dom/rewrite/imports/NewImportEntry.java | 38 + .../dom/rewrite/imports/OnDemandComputer.java | 127 + .../rewrite/imports/OnDemandReduction.java | 42 + .../imports/OrderPreservingImportAdder.java | 180 + .../rewrite/imports/OriginalImportEntry.java | 82 + ...kageAndContainingTypeImportComparator.java | 29 + .../imports/PackageImportComparator.java | 81 + .../RemovedImportCommentReassigner.java | 189 + .../imports/ReorderingImportAdder.java | 47 + .../core/dom/rewrite/imports/RewriteSite.java | 63 + .../StaticConflictingSimpleNameFinder.java | 88 + .../TypeConflictingSimpleNameFinder.java | 110 + .../internal/core/dom/util/DOMASTUtil.java | 220 + .../eval/CodeSnippetAllocationExpression.java | 306 + .../internal/eval/CodeSnippetClassFile.java | 234 + .../internal/eval/CodeSnippetCompiler.java | 69 + .../internal/eval/CodeSnippetEnvironment.java | 96 + .../internal/eval/CodeSnippetEvaluator.java | 221 + .../eval/CodeSnippetFieldReference.java | 350 + .../internal/eval/CodeSnippetMessageSend.java | 363 + .../jdt/internal/eval/CodeSnippetParser.java | 866 + .../CodeSnippetQualifiedNameReference.java | 608 + .../eval/CodeSnippetReturnStatement.java | 167 + .../jdt/internal/eval/CodeSnippetScope.java | 621 + .../eval/CodeSnippetSingleNameReference.java | 622 + .../internal/eval/CodeSnippetSkeleton.java | 258 + .../eval/CodeSnippetSuperReference.java | 76 + .../eval/CodeSnippetThisReference.java | 151 + .../internal/eval/CodeSnippetToCuMapper.java | 349 + .../eval/CodeSnippetTypeDeclaration.java | 94 + .../internal/eval/EvaluationConstants.java | 34 + .../jdt/internal/eval/EvaluationContext.java | 666 + .../jdt/internal/eval/EvaluationResult.java | 236 + .../eclipse/jdt/internal/eval/Evaluator.java | 194 + .../jdt/internal/eval/GlobalVariable.java | 73 + .../eclipse/jdt/internal/eval/IRequestor.java | 31 + .../jdt/internal/eval/InstallException.java | 38 + .../jdt/internal/eval/VariablesEvaluator.java | 313 + .../jdt/internal/eval/VariablesInfo.java | 69 + .../forceQualifierUpdate.txt | 12 + .../jdt/core/formatter/CodeFormatter.java | 320 + .../formatter/CodeFormatterApplication.java | 435 + .../DefaultCodeFormatterConstants.java | 6139 ++ .../core/formatter/IndentManipulation.java | 449 + .../jdt/core/formatter/messages.properties | 47 + .../eclipse/jdt/core/formatter/package.html | 19 + .../formatter/CommentsPreparator.java | 1524 + .../formatter/DefaultCodeFormatter.java | 533 + .../DefaultCodeFormatterOptions.java | 3750 ++ .../formatter/LineBreaksPreparator.java | 771 + .../internal/formatter/OneLineEnforcer.java | 273 + .../internal/formatter/SpacePreparator.java | 1264 + .../internal/formatter/TextEditsBuilder.java | 556 + .../eclipse/jdt/internal/formatter/Token.java | 358 + .../jdt/internal/formatter/TokenManager.java | 454 + .../internal/formatter/TokenTraverser.java | 120 + .../internal/formatter/linewrap/Aligner.java | 294 + .../linewrap/CommentWrapExecutor.java | 313 + .../formatter/linewrap/WrapExecutor.java | 750 + .../formatter/linewrap/WrapPreparator.java | 1627 + .../internal/formatter/old/CodeFormatter.java | 170 + .../e425/org.eclipse.jdt.core/grammar/java.g | 3121 + .../integration/DefaultLanguageSupport.java | 172 + .../jdt/groovy/integration/EventHandler.java | 26 + .../integration/ISupplementalIndexer.java | 36 + .../groovy/integration/LanguageSupport.java | 159 + .../integration/LanguageSupportFactory.java | 219 + .../jdt/groovy/integration/NoopIndexer.java | 37 + .../jdtCompilerAdapter.jar | Bin 0 -> 14388 bytes .../org.eclipse.jdt.core/jdt_core_style.css | 18 + .../org/eclipse/jdt/core/BindingKey.java | 339 + .../eclipse/jdt/core/BufferChangedEvent.java | 116 + .../core/ClasspathContainerInitializer.java | 374 + .../core/ClasspathVariableInitializer.java | 55 + .../eclipse/jdt/core/CompletionContext.java | 354 + .../org/eclipse/jdt/core/CompletionFlags.java | 54 + .../eclipse/jdt/core/CompletionProposal.java | 1818 + .../eclipse/jdt/core/CompletionRequestor.java | 387 + .../jdt/core/CompletionRequestorAdapter.java | 196 + .../eclipse/jdt/core/CorrectionEngine.java | 487 + .../eclipse/jdt/core/ElementChangedEvent.java | 131 + .../model/org/eclipse/jdt/core/Flags.java | 564 + .../org/eclipse/jdt/core/IAccessRule.java | 130 + .../org/eclipse/jdt/core/IAnnotatable.java | 44 + .../org/eclipse/jdt/core/IAnnotation.java | 75 + .../model/org/eclipse/jdt/core/IBuffer.java | 289 + .../jdt/core/IBufferChangedListener.java | 33 + .../org/eclipse/jdt/core/IBufferFactory.java | 38 + .../org/eclipse/jdt/core/IClassFile.java | 153 + .../eclipse/jdt/core/IClasspathAttribute.java | 296 + .../eclipse/jdt/core/IClasspathContainer.java | 143 + .../org/eclipse/jdt/core/IClasspathEntry.java | 531 + .../org/eclipse/jdt/core/ICodeAssist.java | 294 + .../jdt/core/ICodeCompletionRequestor.java | 266 + .../org/eclipse/jdt/core/ICodeFormatter.java | 47 + .../eclipse/jdt/core/ICompilationUnit.java | 849 + .../jdt/core/ICompletionRequestor.java | 429 + .../jdt/core/ICorrectionRequestor.java | 181 + .../jdt/core/IElementChangedListener.java | 34 + .../model/org/eclipse/jdt/core/IField.java | 102 + .../eclipse/jdt/core/IImportContainer.java | 33 + .../eclipse/jdt/core/IImportDeclaration.java | 52 + .../org/eclipse/jdt/core/IInitializer.java | 23 + .../eclipse/jdt/core/IJarEntryResource.java | 80 + .../org/eclipse/jdt/core/IJavaElement.java | 383 + .../eclipse/jdt/core/IJavaElementDelta.java | 430 + .../org/eclipse/jdt/core/IJavaModel.java | 269 + .../eclipse/jdt/core/IJavaModelMarker.java | 129 + .../eclipse/jdt/core/IJavaModelStatus.java | 84 + .../jdt/core/IJavaModelStatusConstants.java | 388 + .../org/eclipse/jdt/core/IJavaProject.java | 1268 + .../org/eclipse/jdt/core/ILocalVariable.java | 102 + .../model/org/eclipse/jdt/core/IMember.java | 152 + .../eclipse/jdt/core/IMemberValuePair.java | 174 + .../model/org/eclipse/jdt/core/IMethod.java | 298 + .../eclipse/jdt/core/IModularClassFile.java | 32 + .../eclipse/jdt/core/IModuleDescription.java | 94 + .../model/org/eclipse/jdt/core/IOpenable.java | 199 + .../eclipse/jdt/core/IOrdinaryClassFile.java | 34 + .../eclipse/jdt/core/IPackageDeclaration.java | 31 + .../eclipse/jdt/core/IPackageFragment.java | 272 + .../jdt/core/IPackageFragmentRoot.java | 465 + .../model/org/eclipse/jdt/core/IParent.java | 42 + .../eclipse/jdt/core/IProblemRequestor.java | 57 + .../model/org/eclipse/jdt/core/IRegion.java | 70 + .../eclipse/jdt/core/ISourceManipulation.java | 117 + .../org/eclipse/jdt/core/ISourceRange.java | 49 + .../eclipse/jdt/core/ISourceReference.java | 116 + .../model/org/eclipse/jdt/core/IType.java | 1308 + .../org/eclipse/jdt/core/ITypeHierarchy.java | 307 + .../core/ITypeHierarchyChangedListener.java | 32 + .../org/eclipse/jdt/core/ITypeParameter.java | 83 + .../model/org/eclipse/jdt/core/ITypeRoot.java | 109 + .../org/eclipse/jdt/core/IWorkingCopy.java | 386 + .../org/eclipse/jdt/core/JavaConventions.java | 1015 + .../model/org/eclipse/jdt/core/JavaCore.java | 6450 ++ .../eclipse/jdt/core/JavaModelException.java | 191 + .../eclipse/jdt/core/NamingConventions.java | 1149 + .../model/org/eclipse/jdt/core/Signature.java | 3023 + .../org/eclipse/jdt/core/SourceRange.java | 91 + .../org/eclipse/jdt/core/ToolFactory.java | 602 + .../eclipse/jdt/core/WorkingCopyOwner.java | 277 + .../jdt/core/compiler/BuildContext.java | 104 + .../core/compiler/CompilationParticipant.java | 161 + .../eclipse/jdt/core/compiler/IScanner.java | 159 + .../jdt/core/compiler/ITerminalSymbols.java | 213 + .../jdt/core/compiler/ReconcileContext.java | 299 + .../jdt/core/eval/ICodeSnippetRequestor.java | 174 + .../jdt/core/eval/IEvaluationContext.java | 565 + .../jdt/core/eval/IGlobalVariable.java | 49 + .../org/eclipse/jdt/core/eval/package.html | 17 + .../eclipse/jdt/core/jdom/DOMException.java | 43 + .../org/eclipse/jdt/core/jdom/DOMFactory.java | 147 + .../jdt/core/jdom/IDOMCompilationUnit.java | 77 + .../eclipse/jdt/core/jdom/IDOMFactory.java | 203 + .../org/eclipse/jdt/core/jdom/IDOMField.java | 86 + .../org/eclipse/jdt/core/jdom/IDOMImport.java | 74 + .../jdt/core/jdom/IDOMInitializer.java | 60 + .../org/eclipse/jdt/core/jdom/IDOMMember.java | 65 + .../org/eclipse/jdt/core/jdom/IDOMMethod.java | 245 + .../org/eclipse/jdt/core/jdom/IDOMNode.java | 284 + .../eclipse/jdt/core/jdom/IDOMPackage.java | 48 + .../org/eclipse/jdt/core/jdom/IDOMType.java | 217 + .../org/eclipse/jdt/core/jdom/package.html | 24 + .../model/org/eclipse/jdt/core/package.html | 27 + .../jdt/core/provisional/JavaModelAccess.java | 81 + .../jdt/core/util/ByteCodeVisitorAdapter.java | 1718 + .../core/util/ClassFileBytesDisassembler.java | 87 + .../jdt/core/util/ClassFormatException.java | 68 + .../jdt/core/util/CompilationUnitSorter.java | 453 + .../jdt/core/util/ExternalAnnotationUtil.java | 920 + .../eclipse/jdt/core/util/IAnnotation.java | 54 + .../jdt/core/util/IAnnotationComponent.java | 45 + .../core/util/IAnnotationComponentValue.java | 204 + .../util/IAnnotationDefaultAttribute.java | 32 + .../core/util/IAttributeNamesConstants.java | 217 + .../core/util/IBootstrapMethodsAttribute.java | 43 + .../jdt/core/util/IBootstrapMethodsEntry.java | 27 + .../jdt/core/util/IBytecodeVisitor.java | 306 + .../jdt/core/util/IClassFileAttribute.java | 47 + .../jdt/core/util/IClassFileDisassembler.java | 59 + .../jdt/core/util/IClassFileReader.java | 272 + .../eclipse/jdt/core/util/ICodeAttribute.java | 109 + .../eclipse/jdt/core/util/IComponentInfo.java | 82 + .../eclipse/jdt/core/util/IConstantPool.java | 57 + .../jdt/core/util/IConstantPoolConstant.java | 149 + .../jdt/core/util/IConstantPoolEntry.java | 245 + .../jdt/core/util/IConstantPoolEntry2.java | 63 + .../jdt/core/util/IConstantPoolEntry3.java | 63 + .../core/util/IConstantValueAttribute.java | 41 + .../core/util/IEnclosingMethodAttribute.java | 80 + .../jdt/core/util/IExceptionAttribute.java | 50 + .../jdt/core/util/IExceptionTableEntry.java | 62 + .../jdt/core/util/IExtendedAnnotation.java | 161 + .../util/IExtendedAnnotationConstants.java | 60 + .../org/eclipse/jdt/core/util/IFieldInfo.java | 117 + .../jdt/core/util/IInnerClassesAttribute.java | 43 + .../util/IInnerClassesAttributeEntry.java | 89 + .../jdt/core/util/ILineNumberAttribute.java | 43 + .../core/util/ILocalVariableAttribute.java | 43 + .../util/ILocalVariableReferenceInfo.java | 53 + .../core/util/ILocalVariableTableEntry.java | 87 + .../ILocalVariableTypeTableAttribute.java | 43 + .../util/ILocalVariableTypeTableEntry.java | 88 + .../eclipse/jdt/core/util/IMethodInfo.java | 142 + .../core/util/IMethodParametersAttribute.java | 51 + .../jdt/core/util/IModifierConstants.java | 96 + .../jdt/core/util/IModuleAttribute.java | 141 + .../core/util/IModuleMainClassAttribute.java | 38 + .../core/util/IModulePackagesAttribute.java | 45 + .../jdt/core/util/INestHostAttribute.java | 34 + .../core/util/INestMemberAttributeEntry.java | 35 + .../jdt/core/util/INestMembersAttribute.java | 38 + .../jdt/core/util/IOpcodeMnemonics.java | 233 + .../jdt/core/util/IPackageVisibilityInfo.java | 65 + .../jdt/core/util/IParameterAnnotation.java | 40 + .../util/IPermittedSubclassesAttribute.java | 41 + .../IPermittedSubclassesAttributeEntry.java | 39 + .../eclipse/jdt/core/util/IProvidesInfo.java | 60 + .../jdt/core/util/IRecordAttribute.java | 40 + .../eclipse/jdt/core/util/IRequiresInfo.java | 60 + ...IRuntimeInvisibleAnnotationsAttribute.java | 39 + ...nvisibleParameterAnnotationsAttribute.java | 39 + ...timeInvisibleTypeAnnotationsAttribute.java | 41 + .../IRuntimeVisibleAnnotationsAttribute.java | 39 + ...eVisibleParameterAnnotationsAttribute.java | 39 + ...untimeVisibleTypeAnnotationsAttribute.java | 41 + .../jdt/core/util/ISignatureAttribute.java | 40 + .../jdt/core/util/ISourceAttribute.java | 40 + .../jdt/core/util/IStackMapAttribute.java | 42 + .../eclipse/jdt/core/util/IStackMapFrame.java | 105 + .../core/util/IStackMapTableAttribute.java | 42 + .../jdt/core/util/IVerificationTypeInfo.java | 117 + .../jdt/core/util/OpcodeStringValues.java | 233 + .../org/eclipse/jdt/core/util/package.html | 14 + .../compiler/DocumentElementParser.java | 1607 + .../jdt/internal/compiler/ExtraFlags.java | 107 + .../compiler/IDocumentElementRequestor.java | 415 + .../compiler/ISourceElementRequestor.java | 248 + .../compiler/SourceElementNotifier.java | 964 + .../compiler/SourceElementParser.java | 1179 + .../SourceElementRequestorAdapter.java | 241 + .../compiler/SourceJavadocParser.java | 142 + .../compiler/parser/SourceTypeConverter.java | 727 + .../compiler/parser/TypeConverter.java | 608 + .../jdt/internal/core/ASTHolderCUInfo.java | 27 + .../jdt/internal/core/AbstractClassFile.java | 516 + .../jdt/internal/core/AbstractModule.java | 199 + .../jdt/internal/core/AnnotatableInfo.java | 74 + .../eclipse/jdt/internal/core/Annotation.java | 153 + .../jdt/internal/core/AnnotationInfo.java | 40 + .../internal/core/BasicCompilationUnit.java | 200 + .../core/BatchInitializationMonitor.java | 97 + .../jdt/internal/core/BatchOperation.java | 64 + .../core/BecomeWorkingCopyOperation.java | 83 + .../jdt/internal/core/BinaryField.java | 143 + .../internal/core/BinaryLambdaExpression.java | 40 + .../jdt/internal/core/BinaryLambdaMethod.java | 32 + .../jdt/internal/core/BinaryMember.java | 188 + .../jdt/internal/core/BinaryMethod.java | 772 + .../jdt/internal/core/BinaryModule.java | 144 + .../internal/core/BinaryRecordComponent.java | 143 + .../eclipse/jdt/internal/core/BinaryType.java | 1146 + .../internal/core/BinaryTypeConverter.java | 372 + .../org/eclipse/jdt/internal/core/Buffer.java | 505 + .../jdt/internal/core/BufferCache.java | 75 + .../internal/core/BufferFactoryWrapper.java | 59 + .../jdt/internal/core/BufferManager.java | 149 + .../core/CancelableNameEnvironment.java | 75 + .../core/CancelableProblemFactory.java | 44 + .../core/ChangeClasspathOperation.java | 104 + .../eclipse/jdt/internal/core/ClassFile.java | 615 + .../jdt/internal/core/ClassFileInfo.java | 431 + .../internal/core/ClassFileWorkingCopy.java | 130 + .../internal/core/ClasspathAccessRule.java | 69 + .../jdt/internal/core/ClasspathAttribute.java | 56 + .../jdt/internal/core/ClasspathChange.java | 596 + .../jdt/internal/core/ClasspathEntry.java | 2589 + .../internal/core/ClasspathValidation.java | 86 + .../core/CommitWorkingCopyOperation.java | 227 + .../jdt/internal/core/CompilationGroup.java | 5 + .../jdt/internal/core/CompilationUnit.java | 1495 + .../core/CompilationUnitElementInfo.java | 81 + .../core/CompilationUnitProblemFinder.java | 372 + .../CompilationUnitStructureRequestor.java | 956 + .../internal/core/CopyElementsOperation.java | 277 + .../CopyPackageFragmentRootOperation.java | 267 + .../core/CopyResourceElementsOperation.java | 868 + .../core/CreateCompilationUnitOperation.java | 179 + .../core/CreateElementInCUOperation.java | 325 + .../internal/core/CreateFieldOperation.java | 148 + .../internal/core/CreateImportOperation.java | 185 + .../core/CreateInitializerOperation.java | 124 + .../internal/core/CreateMethodOperation.java | 134 + .../CreatePackageDeclarationOperation.java | 139 + .../core/CreatePackageFragmentOperation.java | 172 + .../core/CreateTypeHierarchyOperation.java | 131 + .../core/CreateTypeMemberOperation.java | 235 + .../internal/core/CreateTypeOperation.java | 138 + .../core/DefaultWorkingCopyOwner.java | 43 + .../core/DeleteElementsOperation.java | 197 + .../DeletePackageFragmentRootOperation.java | 171 + .../core/DeleteResourceElementsOperation.java | 145 + .../internal/core/DeltaProcessingState.java | 673 + .../jdt/internal/core/DeltaProcessor.java | 2898 + .../core/DiscardWorkingCopyOperation.java | 82 + .../jdt/internal/core/DocumentAdapter.java | 44 + .../core/DynamicProjectReferences.java | 44 + .../jdt/internal/core/ElementCache.java | 99 + .../core/ExternalAnnotationTracker.java | 244 + .../internal/core/ExternalFolderChange.java | 64 + .../internal/core/ExternalFoldersManager.java | 593 + .../internal/core/ExternalJavaProject.java | 76 + .../core/ExternalPackageFragmentRoot.java | 144 + .../internal/core/IJavaElementRequestor.java | 43 + .../core/INameEnvironmentWithProgress.java | 40 + .../jdt/internal/core/INamingRequestor.java | 21 + .../jdt/internal/core/IPathRequestor.java | 18 + .../jdt/internal/core/ImportContainer.java | 130 + .../internal/core/ImportContainerInfo.java | 27 + .../jdt/internal/core/ImportDeclaration.java | 127 + .../core/ImportDeclarationElementInfo.java | 56 + .../jdt/internal/core/Initializer.java | 130 + .../internal/core/InitializerElementInfo.java | 21 + .../core/InitializerWithChildrenInfo.java | 31 + .../core/InternalNamingConventions.java | 838 + .../core/JModPackageFragmentRoot.java | 61 + .../jdt/internal/core/JarEntryDirectory.java | 68 + .../jdt/internal/core/JarEntryFile.java | 102 + .../jdt/internal/core/JarEntryResource.java | 108 + .../jdt/internal/core/JarPackageFragment.java | 238 + .../internal/core/JarPackageFragmentInfo.java | 26 + .../internal/core/JarPackageFragmentRoot.java | 481 + .../core/JarPackageFragmentRootInfo.java | 28 + .../core/JavaCorePreferenceInitializer.java | 205 + .../JavaCorePreferenceModifyListener.java | 86 + .../jdt/internal/core/JavaElement.java | 971 + .../jdt/internal/core/JavaElementDelta.java | 841 + .../core/JavaElementDeltaBuilder.java | 511 + .../jdt/internal/core/JavaElementInfo.java | 41 + .../internal/core/JavaElementRequestor.java | 268 + .../eclipse/jdt/internal/core/JavaModel.java | 438 + .../jdt/internal/core/JavaModelCache.java | 334 + .../jdt/internal/core/JavaModelInfo.java | 62 + .../jdt/internal/core/JavaModelManager.java | 5625 ++ .../jdt/internal/core/JavaModelOperation.java | 907 + .../jdt/internal/core/JavaModelStatus.java | 537 + .../jdt/internal/core/JavaProject.java | 4069 ++ .../internal/core/JavaProjectElementInfo.java | 380 + .../jdt/internal/core/JavadocConstants.java | 53 + .../jdt/internal/core/JavadocContents.java | 568 + .../internal/core/JrtPackageFragmentRoot.java | 184 + .../jdt/internal/core/LRUCacheEnumerator.java | 74 + .../jdt/internal/core/LambdaExpression.java | 308 + .../jdt/internal/core/LambdaFactory.java | 106 + .../jdt/internal/core/LambdaMethod.java | 136 + .../jdt/internal/core/LocalVariable.java | 531 + .../org/eclipse/jdt/internal/core/Member.java | 426 + .../jdt/internal/core/MemberElementInfo.java | 55 + .../jdt/internal/core/MemberValuePair.java | 73 + .../jdt/internal/core/ModelUpdater.java | 244 + .../jdt/internal/core/ModularClassFile.java | 322 + .../org/eclipse/jdt/internal/core/Module.java | 64 + .../internal/core/ModuleDescriptionInfo.java | 345 + .../internal/core/ModulePathContainer.java | 83 + .../core/ModulePathContainerInitializer.java | 49 + .../core/ModuleSourcePathManager.java | 133 + .../jdt/internal/core/ModuleUpdater.java | 166 + .../internal/core/MoveElementsOperation.java | 51 + .../MovePackageFragmentRootOperation.java | 276 + .../core/MoveResourceElementsOperation.java | 50 + .../jdt/internal/core/MultiOperation.java | 315 + .../eclipse/jdt/internal/core/NameLookup.java | 1789 + .../jdt/internal/core/NamedMember.java | 335 + .../jdt/internal/core/NonJavaResource.java | 136 + .../eclipse/jdt/internal/core/NullBuffer.java | 30 + .../eclipse/jdt/internal/core/Openable.java | 532 + .../internal/core/OpenableElementInfo.java | 141 + .../internal/core/OverflowingLRUCache.java | 424 + .../jdt/internal/core/PackageDeclaration.java | 80 + .../jdt/internal/core/PackageFragment.java | 639 + .../internal/core/PackageFragmentInfo.java | 58 + .../internal/core/PackageFragmentRoot.java | 997 + .../core/PackageFragmentRootInfo.java | 207 + .../jdt/internal/core/ProjectEntry.java | 95 + .../core/ReconcileWorkingCopyOperation.java | 281 + .../org/eclipse/jdt/internal/core/Region.java | 219 + .../core/RenameElementsOperation.java | 90 + .../core/RenameResourceElementsOperation.java | 74 + .../internal/core/ResolvedBinaryField.java | 67 + .../internal/core/ResolvedBinaryMethod.java | 69 + .../jdt/internal/core/ResolvedBinaryType.java | 74 + .../core/ResolvedLambdaExpression.java | 66 + .../internal/core/ResolvedSourceField.java | 61 + .../internal/core/ResolvedSourceMethod.java | 61 + .../jdt/internal/core/ResolvedSourceType.java | 69 + .../internal/core/SearchableEnvironment.java | 1285 + .../core/SearchableEnvironmentRequestor.java | 132 + .../jdt/internal/core/SelectionRequestor.java | 1162 + .../internal/core/SetClasspathOperation.java | 128 + .../internal/core/SetContainerOperation.java | 214 + .../internal/core/SetVariablesOperation.java | 198 + .../jdt/internal/core/SimpleDelta.java | 128 + .../internal/core/SingleTypeRequestor.java | 101 + .../internal/core/SortElementsOperation.java | 413 + .../core/SourceAnnotationMethodInfo.java | 38 + .../internal/core/SourceConstructorInfo.java | 44 + .../SourceConstructorWithChildrenInfo.java | 31 + .../jdt/internal/core/SourceField.java | 187 + .../internal/core/SourceFieldElementInfo.java | 66 + .../core/SourceFieldWithChildrenInfo.java | 31 + .../jdt/internal/core/SourceMapper.java | 1737 + .../jdt/internal/core/SourceMethod.java | 355 + .../core/SourceMethodElementInfo.java | 102 + .../jdt/internal/core/SourceMethodInfo.java | 47 + .../core/SourceMethodWithChildrenInfo.java | 31 + .../jdt/internal/core/SourceModule.java | 55 + .../jdt/internal/core/SourceRefElement.java | 298 + .../internal/core/SourceRefElementInfo.java | 49 + .../eclipse/jdt/internal/core/SourceType.java | 1015 + .../internal/core/SourceTypeElementInfo.java | 355 + .../jdt/internal/core/TypeParameter.java | 164 + .../core/TypeParameterElementInfo.java | 39 + .../eclipse/jdt/internal/core/TypeVector.java | 155 + .../jdt/internal/core/UserLibrary.java | 220 + .../core/UserLibraryClasspathContainer.java | 75 + ...rLibraryClasspathContainerInitializer.java | 99 + .../jdt/internal/core/UserLibraryManager.java | 193 + .../internal/core/VerboseElementCache.java | 59 + .../eclipse/jdt/internal/core/XMLWriter.java | 28 + .../AbortIncrementalBuildException.java | 29 + .../core/builder/AbstractImageBuilder.java | 913 + .../builder/AdditionalTypeCollection.java | 25 + .../core/builder/BatchImageBuilder.java | 371 + .../internal/core/builder/BuildNotifier.java | 317 + .../core/builder/ClasspathDirectory.java | 291 + .../internal/core/builder/ClasspathJMod.java | 114 + .../internal/core/builder/ClasspathJar.java | 427 + .../internal/core/builder/ClasspathJrt.java | 321 + .../ClasspathJrtWithReleaseOption.java | 333 + .../core/builder/ClasspathLocation.java | 266 + .../core/builder/ClasspathMultiDirectory.java | 153 + .../builder/ClasspathMultiReleaseJar.java | 161 + .../builder/CompilationParticipantResult.java | 164 + .../core/builder/CompressedReader.java | 134 + .../core/builder/CompressedWriter.java | 187 + .../core/builder/ICompilationUnitLocator.java | 28 + .../ImageBuilderInternalException.java | 45 + .../core/builder/IncrementalImageBuilder.java | 1021 + .../internal/core/builder/JavaBuilder.java | 823 + .../builder/MissingSourceFileException.java | 27 + .../core/builder/ModuleEntryProcessor.java | 107 + .../core/builder/ModuleInfoBuilder.java | 106 + .../core/builder/ModulePathEntry.java | 180 + .../core/builder/NameEnvironment.java | 814 + .../jdt/internal/core/builder/NameSet.java | 70 + .../internal/core/builder/ProblemFactory.java | 35 + .../core/builder/QualifiedNameSet.java | 73 + .../core/builder/ReferenceCollection.java | 637 + .../jdt/internal/core/builder/SourceFile.java | 146 + .../jdt/internal/core/builder/State.java | 984 + .../jdt/internal/core/builder/StringSet.java | 85 + .../jdt/internal/core/builder/WorkQueue.java | 60 + .../core/eval/EvaluationContextWrapper.java | 487 + .../core/eval/GlobalVariableWrapper.java | 56 + .../internal/core/eval/RequestorWrapper.java | 78 + .../internal/core/hierarchy/BindingMap.java | 103 + .../core/hierarchy/ChangeCollector.java | 449 + .../core/hierarchy/HierarchyBinaryType.java | 350 + .../core/hierarchy/HierarchyBuilder.java | 332 + .../core/hierarchy/HierarchyResolver.java | 1009 + .../core/hierarchy/HierarchyType.java | 78 + .../hierarchy/IndexBasedHierarchyBuilder.java | 618 + .../RegionBasedHierarchyBuilder.java | 223 + .../hierarchy/RegionBasedTypeHierarchy.java | 152 + .../core/hierarchy/TypeHierarchy.java | 1627 + .../core/jdom/AbstractDOMBuilder.java | 217 + .../internal/core/jdom/CompilationUnit.java | 74 + .../jdt/internal/core/jdom/DOMBuilder.java | 740 + .../core/jdom/DOMCompilationUnit.java | 203 + .../jdt/internal/core/jdom/DOMField.java | 651 + .../jdt/internal/core/jdom/DOMImport.java | 202 + .../internal/core/jdom/DOMInitializer.java | 252 + .../jdt/internal/core/jdom/DOMMember.java | 355 + .../jdt/internal/core/jdom/DOMMethod.java | 808 + .../jdt/internal/core/jdom/DOMNode.java | 989 + .../jdt/internal/core/jdom/DOMPackage.java | 156 + .../jdt/internal/core/jdom/DOMType.java | 835 + .../internal/core/jdom/ILineStartFinder.java | 28 + .../core/jdom/SiblingEnumeration.java | 62 + .../internal/core/jdom/SimpleDOMBuilder.java | 215 + .../jdt/internal/core/util/ASTNodeFinder.java | 186 + .../jdt/internal/core/util/Annotation.java | 98 + .../core/util/AnnotationComponent.java | 70 + .../core/util/AnnotationComponentValue.java | 203 + .../core/util/AnnotationDefaultAttribute.java | 52 + .../internal/core/util/BindingKeyParser.java | 1135 + .../core/util/BindingKeyResolver.java | 806 + .../core/util/BootstrapMethodsAttribute.java | 69 + .../core/util/BootstrapMethodsEntry.java | 57 + .../internal/core/util/CharArrayBuffer.java | 197 + .../core/util/ClassFileAttribute.java | 62 + .../internal/core/util/ClassFileReader.java | 534 + .../internal/core/util/ClassFileStruct.java | 109 + .../jdt/internal/core/util/CodeAttribute.java | 1198 + .../core/util/CodeSnippetParsingUtil.java | 270 + .../core/util/CommentRecorderParser.java | 331 + .../jdt/internal/core/util/ComponentInfo.java | 139 + .../jdt/internal/core/util/ConstantPool.java | 213 + .../internal/core/util/ConstantPoolEntry.java | 428 + .../core/util/ConstantPoolEntry2.java | 119 + .../core/util/ConstantValueAttribute.java | 52 + .../jdt/internal/core/util/DOMFinder.java | 240 + .../internal/core/util/DeduplicationUtil.java | 48 + .../core/util/DefaultBytecodeVisitor.java | 2849 + .../core/util/DefaultStackMapFrame.java | 102 + .../jdt/internal/core/util/Disassembler.java | 3013 + .../core/util/EnclosingMethodAttribute.java | 101 + .../core/util/ExceptionAttribute.java | 77 + .../core/util/ExceptionTableEntry.java | 89 + .../core/util/ExtendedAnnotation.java | 306 + .../jdt/internal/core/util/FieldInfo.java | 199 + .../jdt/internal/core/util/HandleFactory.java | 409 + .../internal/core/util/HashSetOfArray.java | 154 + .../core/util/HashSetOfCharArrayArray.java | 165 + .../core/util/HashtableOfArrayToObject.java | 207 + .../internal/core/util/ICacheEnumeration.java | 42 + .../jdt/internal/core/util/ILRUCacheable.java | 31 + .../core/util/InnerClassesAttribute.java | 72 + .../core/util/InnerClassesAttributeEntry.java | 122 + .../internal/core/util/JavaElementFinder.java | 169 + .../jdt/internal/core/util/KeyKind.java | 126 + .../internal/core/util/KeyToSignature.java | 387 + .../jdt/internal/core/util/LRUCache.java | 711 + .../core/util/LineNumberAttribute.java | 75 + .../core/util/LocalVariableAttribute.java | 74 + .../core/util/LocalVariableReferenceInfo.java | 69 + .../core/util/LocalVariableTableEntry.java | 120 + .../core/util/LocalVariableTypeAttribute.java | 73 + .../util/LocalVariableTypeTableEntry.java | 120 + .../internal/core/util/MementoTokenizer.java | 161 + .../jdt/internal/core/util/Messages.java | 479 + .../jdt/internal/core/util/MethodInfo.java | 251 + .../core/util/MethodParametersAttribute.java | 80 + .../internal/core/util/ModuleAttribute.java | 224 + .../core/util/ModuleMainClassAttribute.java | 57 + .../core/util/ModulePackagesAttribute.java | 79 + .../jdt/internal/core/util/ModuleUtil.java | 152 + .../internal/core/util/NestHostAttribute.java | 49 + .../core/util/NestMembersAttribute.java | 64 + .../core/util/NestMembersAttributeEntry.java | 52 + .../core/util/PackageVisibilityInfo.java | 96 + .../core/util/ParameterAnnotation.java | 73 + .../util/PermittedSubclassesAttribute.java | 67 + .../PermittedSubclassesAttributeEntry.java | 55 + .../jdt/internal/core/util/ProvidesInfo.java | 80 + .../jdt/internal/core/util/PublicScanner.java | 310 + .../internal/core/util/RecordAttribute.java | 58 + .../core/util/RecordedParsingInformation.java | 42 + .../core/util/ReferenceInfoAdapter.java | 75 + .../jdt/internal/core/util/RequiresInfo.java | 80 + .../core/util/ResourceCompilationUnit.java | 84 + .../RuntimeInvisibleAnnotationsAttribute.java | 69 + ...nvisibleParameterAnnotationsAttribute.java | 69 + ...timeInvisibleTypeAnnotationsAttribute.java | 72 + .../RuntimeVisibleAnnotationsAttribute.java | 69 + ...eVisibleParameterAnnotationsAttribute.java | 69 + ...untimeVisibleTypeAnnotationsAttribute.java | 70 + .../core/util/SignatureAttribute.java | 50 + .../internal/core/util/SimpleDocument.java | 289 + .../jdt/internal/core/util/SimpleWordSet.java | 71 + .../core/util/SourceFileAttribute.java | 68 + .../internal/core/util/StackMapAttribute.java | 87 + .../jdt/internal/core/util/StackMapFrame.java | 179 + .../core/util/StackMapTableAttribute.java | 87 + .../internal/core/util/ToStringSorter.java | 60 + .../eclipse/jdt/internal/core/util/Util.java | 3370 + .../internal/core/util/VerificationInfo.java | 79 + .../jdt/internal/core/util/WeakHashSet.java | 229 + .../core/util/WeakHashSetOfCharArray.java | 228 + .../internal/core/util/messages.properties | 466 + .../notes/API_changes.html | 565 + .../notes/R20_buildnotes_jdt-core.html | 4372 ++ .../notes/R21_buildnotes_jdt-core.html | 3306 + .../notes/R30_buildnotes_jdt-core.html | 4492 ++ .../notes/R31_buildnotes_jdt-core.html | 4773 ++ .../notes/R32_buildnotes_jdt-core.html | 3369 + .../notes/R33_buildnotes_jdt-core.html | 3221 + .../notes/R34_buildnotes_jdt-core.html | 3511 + .../notes/R35_buildnotes_jdt-core.html | 2266 + .../notes/R36_buildnotes_jdt-core.html | 2283 + .../notes/R37_buildnotes_jdt-core.html | 1771 + .../notes/porting_guide.html | 349 + .../e425/org.eclipse.jdt.core/plugin.jars | 9 + .../org.eclipse.jdt.core/plugin.properties | 34 + .../e425/org.eclipse.jdt.core/plugin.xml | 303 + jdt-patch/e425/org.eclipse.jdt.core/pom.bak | 301 + jdt-patch/e425/org.eclipse.jdt.core/pom.xml | 177 + .../schema/annotationProcessorManager.exsd | 126 + .../schema/classpathContainerInitializer.exsd | 127 + .../schema/classpathVariableInitializer.exsd | 144 + .../schema/codeFormatter.exsd | 103 + .../schema/compilationParticipant.exsd | 195 + .../org.eclipse.jdt.core/schema/compiler.dtd | 90 + .../schema/javaFormatter.exsd | 128 + .../scripts/GenerateBuildScript$1.class | Bin 0 -> 743 bytes .../scripts/GenerateBuildScript$2.class | Bin 0 -> 719 bytes .../scripts/GenerateBuildScript.class | Bin 0 -> 6280 bytes .../scripts/GenerateBuildScript.java | 152 + .../scripts/GenerateParserScript.java | 144 + .../org.eclipse.jdt.core/scripts/about.html | 36 + .../scripts/antadapter/META-INF/MANIFEST.MF | 14 + .../scripts/antadapter/plugin.properties | 16 + .../scripts/antadapter/plugin.xml | 23 + .../scripts/binary/META-INF/MANIFEST.MF | 28 + .../scripts/build-parser.launch | 20 + .../scripts/build-parser.xml | 35 + .../org.eclipse.jdt.core/scripts/build.xml | 51 + .../scripts/build_ecj.xml | 74 + .../e425/org.eclipse.jdt.core/scripts/ecj.1 | 912 + .../scripts/export-ecj.xml | 222 + .../scripts/export-ejavac.xml | 54 + .../scripts/export-ejavac2.xml | 77 + .../scripts/export-ejavac2_linux.xml | 77 + .../scripts/export-ejavac_linux.xml | 54 + .../scripts/exportplugin.xml | 145 + .../scripts/ikvm_script.xml | 79 + .../scripts/oldexportplugin.xml | 176 + .../scripts/source/META-INF/MANIFEST.MF | 7 + .../eclipse/jdt/core/index/JavaIndexer.java | 45 + .../core/index/JavaIndexerApplication.java | 164 + .../jdt/core/index/messages.properties | 32 + .../org/eclipse/jdt/core/index/package.html | 19 + .../core/search/FieldDeclarationMatch.java | 43 + .../jdt/core/search/FieldReferenceMatch.java | 74 + .../jdt/core/search/IJavaSearchConstants.java | 582 + .../search/IJavaSearchResultCollector.java | 106 + .../jdt/core/search/IJavaSearchScope.java | 134 + .../jdt/core/search/IParallelizable.java | 57 + .../jdt/core/search/ISearchPattern.java | 27 + .../jdt/core/search/ITypeNameRequestor.java | 65 + .../search/LocalVariableDeclarationMatch.java | 44 + .../search/LocalVariableReferenceMatch.java | 73 + .../core/search/MethodDeclarationMatch.java | 44 + .../jdt/core/search/MethodNameMatch.java | 69 + .../core/search/MethodNameMatchRequestor.java | 57 + .../jdt/core/search/MethodNameRequestor.java | 73 + .../jdt/core/search/MethodReferenceMatch.java | 131 + .../core/search/ModuleDeclarationMatch.java | 44 + .../jdt/core/search/ModuleReferenceMatch.java | 46 + .../core/search/PackageDeclarationMatch.java | 44 + .../core/search/PackageReferenceMatch.java | 45 + .../jdt/core/search/ReferenceMatch.java | 134 + .../jdt/core/search/SearchDocument.java | 188 + .../eclipse/jdt/core/search/SearchEngine.java | 1706 + .../eclipse/jdt/core/search/SearchMatch.java | 377 + .../jdt/core/search/SearchParticipant.java | 284 + .../jdt/core/search/SearchPattern.java | 2842 + .../jdt/core/search/SearchRequestor.java | 98 + .../jdt/core/search/TypeDeclarationMatch.java | 44 + .../jdt/core/search/TypeNameMatch.java | 157 + .../core/search/TypeNameMatchRequestor.java | 51 + .../jdt/core/search/TypeNameRequestor.java | 58 + .../search/TypeParameterDeclarationMatch.java | 43 + .../search/TypeParameterReferenceMatch.java | 46 + .../jdt/core/search/TypeReferenceMatch.java | 113 + .../org/eclipse/jdt/core/search/package.html | 18 + .../jdt/internal/core/index/DiskIndex.java | 1354 + .../jdt/internal/core/index/EntryResult.java | 81 + .../core/index/FileIndexLocation.java | 118 + .../jdt/internal/core/index/Index.java | 273 + .../internal/core/index/IndexLocation.java | 156 + .../internal/core/index/IndexQualifier.java | 40 + .../internal/core/index/JarIndexLocation.java | 131 + .../jdt/internal/core/index/MemoryIndex.java | 130 + .../jdt/internal/core/index/MetaIndex.java | 102 + .../nd/java/model/BinaryModuleDescriptor.java | 66 + .../nd/java/model/BinaryModuleFactory.java | 166 + .../nd/java/model/BinaryTypeDescriptor.java | 66 + .../core/nd/java/model/BinaryTypeFactory.java | 217 + .../internal/core/nd/util/CharArrayUtils.java | 523 + .../core/search/AbstractJavaSearchScope.java | 40 + .../core/search/AbstractSearchScope.java | 73 + .../core/search/BasicSearchEngine.java | 2418 + .../internal/core/search/HierarchyScope.java | 488 + ...IRestrictedAccessConstructorRequestor.java | 37 + .../IRestrictedAccessMethodRequestor.java | 39 + .../IRestrictedAccessTypeRequestor.java | 27 + .../core/search/IndexQueryRequestor.java | 28 + .../internal/core/search/IndexSelector.java | 363 + .../core/search/JavaSearchDocument.java | 97 + .../search/JavaSearchMethodNameMatch.java | 59 + .../core/search/JavaSearchParticipant.java | 168 + .../internal/core/search/JavaSearchScope.java | 689 + .../core/search/JavaSearchTypeNameMatch.java | 122 + .../core/search/JavaWorkspaceScope.java | 247 + .../MethodNameMatchRequestorWrapper.java | 94 + .../search/MethodNameRequestorWrapper.java | 67 + .../search/NameMatchRequestorWrapper.java | 192 + .../internal/core/search/PathCollector.java | 43 + .../core/search/PatternSearchJob.java | 356 + .../internal/core/search/StringOperation.java | 497 + .../core/search/SubTypeSearchJob.java | 65 + .../search/TypeNameMatchRequestorWrapper.java | 85 + .../core/search/TypeNameRequestorWrapper.java | 51 + .../core/search/UnindexedSearchScope.java | 105 + .../core/search/indexing/AbstractIndexer.java | 280 + .../search/indexing/AddFolderToIndex.java | 119 + .../search/indexing/AddJarFileToIndex.java | 323 + .../core/search/indexing/AddJrtToIndex.java | 316 + .../core/search/indexing/BinaryContainer.java | 69 + .../core/search/indexing/BinaryIndexer.java | 967 + .../search/indexing/DefaultJavaIndexer.java | 62 + .../core/search/indexing/IIndexConstants.java | 80 + .../core/search/indexing/IndexAllProject.java | 256 + .../search/indexing/IndexBinaryFolder.java | 162 + .../core/search/indexing/IndexManager.java | 1843 + .../search/indexing/IndexNamesRegistry.java | 141 + .../core/search/indexing/IndexRequest.java | 56 + .../core/search/indexing/IndexingParser.java | 71 + .../core/search/indexing/ManifestIndexer.java | 25 + .../core/search/indexing/QualifierQuery.java | 70 + .../search/indexing/ReadWriteMonitor.java | 115 + .../indexing/RemoveFolderFromIndex.java | 81 + .../core/search/indexing/RemoveFromIndex.java | 56 + .../core/search/indexing/SaveIndex.java | 60 + .../core/search/indexing/SourceIndexer.java | 265 + .../indexing/SourceIndexerRequestor.java | 542 + .../core/search/matching/AndLocator.java | 322 + .../core/search/matching/AndPattern.java | 98 + .../matching/ClassFileMatchLocator.java | 584 + .../matching/ClasspathSourceDirectory.java | 172 + .../ConstructorDeclarationPattern.java | 161 + .../search/matching/ConstructorLocator.java | 415 + .../search/matching/ConstructorPattern.java | 589 + .../DeclarationOfAccessedFieldsPattern.java | 32 + ...DeclarationOfReferencedMethodsPattern.java | 34 + .../DeclarationOfReferencedTypesPattern.java | 31 + .../core/search/matching/FieldLocator.java | 392 + .../core/search/matching/FieldPattern.java | 135 + .../matching/ImportMatchLocatorParser.java | 59 + .../IndexBasedJavaSearchEnvironment.java | 34 + .../search/matching/IntersectingPattern.java | 96 + .../matching/JavaSearchNameEnvironment.java | 566 + .../search/matching/JavaSearchPattern.java | 464 + .../search/matching/LocalVariableLocator.java | 156 + .../search/matching/LocalVariablePattern.java | 92 + .../core/search/matching/MatchLocator.java | 3484 + .../search/matching/MatchLocatorParser.java | 1099 + .../core/search/matching/MatchingNodeSet.java | 214 + .../matching/MemberDeclarationVisitor.java | 341 + .../matching/MethodDeclarationPattern.java | 283 + .../core/search/matching/MethodLocator.java | 970 + .../core/search/matching/MethodPattern.java | 406 + .../ModularClassFileMatchLocator.java | 228 + .../core/search/matching/ModuleLocator.java | 89 + .../core/search/matching/ModulePattern.java | 146 + .../matching/MultiTypeDeclarationPattern.java | 218 + .../core/search/matching/OrLocator.java | 376 + .../core/search/matching/OrPattern.java | 151 + .../matching/PackageDeclarationLocator.java | 33 + .../matching/PackageDeclarationPattern.java | 41 + .../matching/PackageReferenceLocator.java | 378 + .../matching/PackageReferencePattern.java | 89 + .../core/search/matching/PatternLocator.java | 1016 + .../core/search/matching/PossibleMatch.java | 238 + .../search/matching/PossibleMatchSet.java | 71 + .../QualifiedTypeDeclarationPattern.java | 145 + .../SecondaryTypeDeclarationPattern.java | 50 + .../matching/SuperTypeNamesCollector.java | 316 + .../matching/SuperTypeReferenceLocator.java | 138 + .../matching/SuperTypeReferencePattern.java | 302 + .../matching/TypeDeclarationLocator.java | 233 + .../matching/TypeDeclarationPattern.java | 416 + .../search/matching/TypeParameterLocator.java | 152 + .../search/matching/TypeParameterPattern.java | 139 + .../search/matching/TypeReferenceLocator.java | 848 + .../search/matching/TypeReferencePattern.java | 174 + .../core/search/matching/VariableLocator.java | 93 + .../core/search/matching/VariablePattern.java | 72 + .../internal/core/search/processing/IJob.java | 61 + .../core/search/processing/JobManager.java | 529 + jdt-patch/e425/tests-pom/pom.xml | 46 + pom.xml | 34 + 2099 files changed, 1266399 insertions(+), 31 deletions(-) create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/.gitignore create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/.project create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/build.properties create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.properties create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.xml create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/license.html create mode 100644 jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/pom.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.classpath create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.gitignore create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.project create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.resources.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.runtime.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.core.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.ui.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/META-INF/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/about.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/build.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/forceQualifierUpdate.txt create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/pom.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractLeakTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AnnotationDependencyTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug530366Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug531382Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug544921Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549457Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549646Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug561287Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug562420Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug564905Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug571363Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompressedWriterTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FriendDependencyTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/GetResourcesTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Java50Tests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsAfter9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsBefore9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ReferenceCollectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StateTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestBuilderParticipant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/test.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.builder/workspace/Test571363.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.classpath create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.gitignore create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.project create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.resources.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.runtime.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/eclipse.inf create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/about.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/build.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/plugin.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/pom.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/TestJavadocVisibility.zip create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/Activator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/CharDeduplicationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/DeduplicationUtilTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/map/CharArrayMapperTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTest2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionParserTestKeyword.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/CompletionRecoveryTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DietRecoveryTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DocumentElementParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/DualParseSyntaxErrorTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/EnumCompletionParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/EnumDietRecoveryTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/EnumSelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/FieldAccessCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericDietRecoveryTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsCompletionParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/GenericsSelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/InnerTypeCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/JavadocCompletionParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LabelStatementCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/LambdaExpressionSyntaxTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ModuleDeclarationSyntaxTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/NameReferenceCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest1_7.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/PatternMatchingSelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceExpressionSyntaxTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/RunCompletionParserTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionJavadocTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest10.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest12.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest13.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionParserTest9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SelectionTest2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SingleCompletionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceImport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourcePackage.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/StatementRecoveryTest_1_5.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SyntaxErrorTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestAll.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TestSourceElementRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/TypeAnnotationSyntaxTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ASTImplTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractBatchCompilerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractComparableTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractNullAnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest_9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ArrayTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssertionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_5.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest_1_7.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutoBoxingTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AutomaticModuleNamingTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_14.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_15.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_16.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BinaryLiteralTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BooleanTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BootstrapMethodAttributeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CastTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CharOperationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileComparatorTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_17.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_4.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_5.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_1_8.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClasspathJmodTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CollisionCase.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_6.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_7.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_CLDC.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConcurrentBatchCompilerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConditionalExpressionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DebugAttributeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DefaultJavaRuntimeEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated15Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated18Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Deprecated9Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/DeprecatedTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnclosingMethodAttributeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/EnumTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExpressionContextTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiterals15Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FieldAccessTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/FlowAnalysisTest8.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForStatementTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeSignatureTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_7.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_1_8.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericsRegressionTest_9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GrammarCoverageTests308.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InMemoryNameEnvironment9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InitializationTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest_1_5.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofExpressionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InstanceofPrimaryPatternTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InterfaceMethodsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InterfaceMethodsTest_9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalHexFloatTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InternalScannerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JEP181NestTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JEP286ReservedWordTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JEP286Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JEP323VarLambdaParamsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JSR308SpecSnippetTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JSR335ClassFileTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocBugsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForClass.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForConstructor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForInterface.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestForRecord.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestMixed.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTestOptions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_15.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_3.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_4.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest_1_5.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Jsr14Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaExpressionsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaRegressionTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LambdaShapeTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LineNumberAttributeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalEnumTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalStaticsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ManifestAnalyzerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodHandleTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodParametersAttributeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ModuleAttributeTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ModuleCompilationTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MultiReleaseJarTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeLambdaExpressionsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NegativeTypeAnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationBatchCompilerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTests9.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullChecksTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceImplTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceImplTransformations.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTestAsserts.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullTypeAnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NumericTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/OverloadResolutionTest8.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PackageBindingTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PatternMatching16Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PolymorphicSignatureTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PreviewFeatureTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemConstructorTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProblemTypeAndMethodTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/PublicScannerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RegressionTestSetup.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RepeatableAnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Requestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ResourceLeakTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RunComparableTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RuntimeTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ScannerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypesTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SerialVersionUIDTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SerializableLambdaTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StaticImportTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuperTypeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SuppressWarningsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchExpressionsYieldTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TextBlockTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatement17Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatement9Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryStatementTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TryWithResourcesStatementTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TypeAnnotationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnderscoresInLiteralsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode10Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode11Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode12_1Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode13Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode18Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Unicode9Test.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedModuleTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UtilTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ValueBasedAnnotationTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/XLargeTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/XLargeTest2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/util/HashtableOfObjectTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/CodeSnippetTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationSetup.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationContextWrapperTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationSetup.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/EvaluationTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/JDIStackFrame.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeCodeSnippetTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/NegativeVariableTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SanityTestEvaluationResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleCodeSnippetTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/SimpleVariableTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/TestAll.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/VariableTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetClassLoader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/CodeSnippetRunner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/eval/target/IDEInterface.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/PerformanceTestSuite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/StopableTestCase.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestCase.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestListener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/junit/extension/TestResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/AbstractReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/DRLVMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/J9VirtualMachine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/JRockitVMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/MacVMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/NullConsoleReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/ProxyConsoleReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/RuntimeConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/SideCarJ9VMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/SideCarVMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/StandardVMLauncher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/TargetInterface.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/runtime/VMInputStream.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/CompilerTestSetup.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/TestVerifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/Util.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/VerifyTests.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/util/ZipEntryStorageException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/test.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Bug422832ClassFile/aspose.pdf.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/ParameterNames$1.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/ParameterNames$1Local.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/ParameterNames.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test372011.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test374129.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test374129_1.8.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test380112.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test388281.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test388281_1.8.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test454182.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test548596.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/Test571363.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/TestBootstrapMethodAtt.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/bug492322-compiled-with-4.6.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/workspace/multi.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.classpath create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.gitignore create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.options create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.project create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/.api_filters create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/org.eclipse.core.resources.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/org.eclipse.core.runtime.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/org.eclipse.jdt.core.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/org.eclipse.jdt.ui.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/org.eclipse.pde.api.tools.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/.settings/org.eclipse.pde.prefs create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/META-INF/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/META-INF/eclipse.inf create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/about.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/antadapter/META-INF/eclipse.inf create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/BuildJarIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/CheckDebugAttributes.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/internal/antadapter/AntAdapterMessages.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/antadapter/org/eclipse/jdt/internal/antadapter/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/core/compiler/batch/BatchCompiler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/core/compiler/batch/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/BasicModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/BatchCompilerRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJep247Jdk12.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJmod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathJrt.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathLocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathMultiReleaseJar.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/CompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/FileSystem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/build.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionElementNotifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionRequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionUnitStructureRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/IExtendedCompletionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISearchRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ISelectionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalCompletionProposal.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/InternalExtendedCompletionContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/MissingTypesGuesser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/RelevanceConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/ThrownExceptionFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/UnresolvedReferenceNameFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/AssistNodeParentAnnotationArrayInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadoc.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionJavadocParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeDetector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionNodeFound.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationMemberValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnAnnotationOfType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnBreakStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnClassLiteralAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnContinueStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExplicitConstructorCall.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnExportReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnFieldType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnImportReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadoc.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocFieldReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocMessageSend.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocModuleReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocParamNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocTag.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnJavadocTypeParamReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword1.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword3.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModule2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeywordModuleInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnLocalName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMarkerAnnotationName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMemberValueName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMessageSend.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMessageSendName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodReturnType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnMethodTypeParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnModuleDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnModuleReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageVisibilityReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnParameterizedQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnProvidesImplementationsQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnProvidesImplementationsSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnProvidesInterfacesQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnProvidesInterfacesSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnReferenceExpressionName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnStringLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnUsesQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnUsesSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/InvalidCursorLocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistCompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistImportDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistOptions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistPackageDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistSourceType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistTypeParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Keywords.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/RestrictedIdentifiers.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadoc.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionJavadocParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionNodeFound.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnArgumentName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnExplicitConstructorCall.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnFieldType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnImportReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnLambdaExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnLocalName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnMessageSend.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnModuleDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnModuleReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnNameOfMemberValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageVisibilityReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnParameterizedSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedSuperReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnReferenceExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnReferenceExpressionName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnSuperReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CategorizedProblem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CharOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/CompilationProgress.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/InvalidInputException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/SubwordMatcher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ASTVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/AbstractAnnotationProcessorManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ClassFilePool.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/CompilationResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/Compiler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/DefaultErrorHandlingPolicies.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/GenericAstVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ICompilerRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/IDebugRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/IErrorHandlingPolicy.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/IProblemFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ProcessTaskManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ReadManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractVariableDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AnnotationMethodDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Argument.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ArrayTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Assignment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Block.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BranchStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CastExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Clinit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CombinedBinaryExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompactConstructorDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ConstructorDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ContainerAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ContinueStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EmptyStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExplicitConstructorCall.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExportsStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Expression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExpressionContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ExtendedStringLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FakedTrackingVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FalseLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FieldReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FloatLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/FunctionalExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/GuardedPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IJavadocTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IPolyExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IfStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ImportReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Initializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/IntersectionCastTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Invocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocArraySingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocModuleReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Literal.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MagicLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MemberValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MessageSend.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ModuleDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ModuleReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ModuleStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NullAnnotationMatching.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NullLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/NumberLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OpensStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/OperatorIds.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PackageVisibilityStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Pattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ProvidesStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedSuperReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Receiver.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Reference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/RequiresStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Statement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/StringLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/StringLiteralConcatenation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SubRoutineStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SuperReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/SynchronizedStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TextBlock.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThisReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ThrowStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TrueLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnionTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UnlikelyArgumentCheck.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/UsesStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Wildcard.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithAnnotations.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationMethodInfoWithTypeAnnotations.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/BinaryTypeFormatter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFileStruct.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ClassFormatException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ComponentInfoWithTypeAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ElementValuePairInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationDecorator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/FieldInfoWithTypeAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/InnerClassInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/JavaBinaryNames.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithAnnotations.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithParameterAnnotations.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/MethodInfoWithTypeAnnotations.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/ModuleInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/NonNullDefaultAwareTypeAnnotationWalker.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/RecordComponentInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/TypeAnnotationWalker.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AnnotationTargetTypeConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/AttributeNamesConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/BranchLabel.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CachedIndexEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CaseLabel.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CharArrayCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/DoubleCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ExceptionLabel.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/FloatCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/IntegerCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/Label.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/LongCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/MultiCatchExceptionLabel.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ObjectCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/Opcodes.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrame.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/StackMapFrameCodeStream.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/TypeAnnotationCodeStream.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/VerificationTypeInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRestriction.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AccessRuleSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/AutomaticModuleNaming.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ClassSignature.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/EnumConstantSignature.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryElementValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryNestedType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IBinaryTypeAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ICompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IDependent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IGenericField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IGenericMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IGenericType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IModuleAwareNameEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IModulePathEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IMultiModuleEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/INameEnvironmentExtension.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IRecordComponent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceImport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ISourceType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ITypeAnnotationWalker.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/IUpdatableModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/ModuleReferenceImpl.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/NameEnvironmentAnswer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/env/PackageExportImpl.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ConditionalFlowInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/ExceptionInferenceFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FieldInitsFakingFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/InitializationFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/InsideSubRoutineFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LabelFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/SwitchFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/TryFlowContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/UnconditionalFlowInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerStats.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ITypeRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IrritantSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/StringConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotatableTypeSystem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationHolder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BaseTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BoundSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CatchParameterBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExceptionFormula.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintExpressionFormula.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintFormula.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ConstraintTypeFormula.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/DelegateMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ElementValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtendedTagBits.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExternalAnnotationSuperimposer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IQualifiedTypeResolutionListener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImplicitNullAnnotationVerifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImportBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ImportConflictBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceContext18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceFailureException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceSubstitution.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InferenceVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InnerEmulationDependency.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/InvocationSite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LazilyResolvedMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LocalVariableBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ModuleScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MostSpecificExceptionMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/NullTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterNonNullDefaultProvider.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PlainPackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyParameterizedGenericMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolyTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PolymorphicMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemFieldBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemPackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReasons.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ProblemReferenceBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RawTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/RecordComponentBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReductionResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBindingSetWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SignatureWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SortedCompoundNameVector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SortedSimpleNameVector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceModuleBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeCollisionException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SplitPackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Substitution.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBindingVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeBound.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeSystem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedAnnotationBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/UnresolvedReferenceBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/VoidTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ConflictedParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/JavadocTagConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/NLSTag.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ParserBasicInformation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredExportsStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredImport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredModuleStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredOpensStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredPackageVisibilityStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredProvidesStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredRequiresStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredTypeReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveredUsesStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/RecoveryScannerData.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/TerminalTokens.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/DiagnoseParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/LexStream.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/diagnose/RangeUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser10.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser11.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser12.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser13.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser15.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser16.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser17.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser18.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser19.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser20.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser21.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser22.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser23.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser24.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser3.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser4.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser5.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser6.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser7.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser8.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/parser9.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/readableNames.props create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode10/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode11/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode12_1/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/part3.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode13/start3.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode6_2/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode7/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/part0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/part1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/part14.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/part2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/start0.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/start1.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/unicode8/start2.rsc create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortCompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/AbortType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblem.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemSeverities.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ShouldNotImplement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CharArray.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CharArrayHashMap.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CharArrayMap.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CharArrayMapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CharDeduplication.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CharDelegateMap.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/CtSym.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/FloatUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/GenericXMLWriter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashSetOfInt.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInt.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfIntValues.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfInteger.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfLong.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObject.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToInt.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfObjectToIntArray.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfPackage.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/HashtableOfType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ManifestAnalyzer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Messages.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/ObjectVector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleLookupTable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SimpleSetOfCharArray.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SortedCharArrays.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Sorting.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/SuffixConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/Util.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/component.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/customBuildCallbacks.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTMatcher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRecoveryPropagator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTSyntaxErrorPropagator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTagElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AbstractTypeDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotatableType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Annotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnnotationTypeMemberDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AnonymousClassDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayCreation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ArrayType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AssertStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Assignment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingResolver.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Block.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BlockComment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BodyDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BooleanLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BreakStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CaseDefaultExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CastExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CatchClause.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CharacterLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildListPropertyDescriptor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ChildPropertyDescriptor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ClassInstanceCreation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Comment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConditionalExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ConstructorInvocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ContinueStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CreationReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultASTVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultBindingResolver.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultCommentMapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DefaultValuePairBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Dimension.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DoStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/DocCommentParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EmptyStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnhancedForStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumConstantDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/EnumDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExportsDirective.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Expression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionMethodReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ExpressionStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FieldDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/FileASTRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ForStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/GuardedPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IAnnotationBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IDocElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IExtendedModifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMemberValuePairBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IMethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IModuleBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IPackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ITypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IVariableBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IfStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ImportDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InfixExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Initializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InstanceofExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/InternalASTRewrite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/IntersectionType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/JavaDocRegion.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Javadoc.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LabeledStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LambdaExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/LineComment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MarkerAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberRef.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MemberValuePairBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Message.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodInvocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRef.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodRefParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Modifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleDirective.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleModifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModulePackageAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ModuleQualifiedName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Name.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameEnvironmentWithProgress.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NameQualifiedType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeEventHandler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NodeSearcher.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NormalAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NullPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/NumberLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/OpensDirective.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParameterizedType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ParenthesizedExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Pattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PatternInstanceofExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PostfixExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrefixExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PrimitiveType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ProvidesDirective.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/QualifiedType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecordDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredPackageBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredTypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RecoveredVariableBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/RequiresDirective.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ReturnStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimplePropertyDescriptor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SimpleType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleMemberAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SingleVariableDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Statement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StructuralPropertyDescriptor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperConstructorInvocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperFieldAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodInvocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SuperMethodReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchCase.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SwitchStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/SynchronizedStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TagProperty.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextBlock.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TextElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThisExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ThrowStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TryStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/Type.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeDeclarationStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeLiteral.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeMethodReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/UnionType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/UsesDirective.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationFragment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableDeclarationStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WhileStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/WildcardType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/YieldStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ASTRewrite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ITrackedNodePosition.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ImportRewrite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/ListRewrite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/TargetSourceRangeComputer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/rewrite/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/NaiveASTFlattener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/SourceRangeVerifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFormatter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineCommentEndOffsets.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/LineInformation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ListRewriteEvent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeInfoStore.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/NodeRewriteEvent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEvent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/RewriteEventStore.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/SourceModifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TokenScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/TrackedNodePosition.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ConflictIdentifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ConflictingSimpleNameFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportAdder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportComment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportComparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportDeclarationWriter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportEditor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportGroupComparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportName.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportRewriteAnalyzer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportRewriteConfiguration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ImportsDelta.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/NewImportEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OnDemandComputer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OnDemandReduction.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OrderPreservingImportAdder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/OriginalImportEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/PackageAndContainingTypeImportComparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/PackageImportComparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/RemovedImportCommentReassigner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/ReorderingImportAdder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/RewriteSite.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/StaticConflictingSimpleNameFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/imports/TypeConflictingSimpleNameFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/util/DOMASTUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetCompiler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetEvaluator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetFieldReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetMessageSend.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetQualifiedNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetReturnStatement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSingleNameReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSuperReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetThisReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetToCuMapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetTypeDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/EvaluationResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/Evaluator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/GlobalVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/IRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/InstallException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/VariablesEvaluator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/VariablesInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/forceQualifierUpdate.txt create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/CodeFormatterApplication.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/DefaultCodeFormatterConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/IndentManipulation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/core/formatter/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/CommentsPreparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/DefaultCodeFormatterOptions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/LineBreaksPreparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/OneLineEnforcer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/SpacePreparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TextEditsBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/Token.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TokenManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/TokenTraverser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/Aligner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/CommentWrapExecutor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapExecutor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/linewrap/WrapPreparator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter/old/CodeFormatter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/grammar/java.g create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/groovy/org/codehaus/jdt/groovy/integration/DefaultLanguageSupport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/groovy/org/codehaus/jdt/groovy/integration/EventHandler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/groovy/org/codehaus/jdt/groovy/integration/ISupplementalIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/groovy/org/codehaus/jdt/groovy/integration/LanguageSupport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/groovy/org/codehaus/jdt/groovy/integration/LanguageSupportFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/groovy/org/codehaus/jdt/groovy/integration/NoopIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/jdtCompilerAdapter.jar create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/jdt_core_style.css create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BindingKey.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/BufferChangedEvent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ClasspathContainerInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ClasspathVariableInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionFlags.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionProposal.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CompletionRequestorAdapter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/CorrectionEngine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ElementChangedEvent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAccessRule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotatable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBuffer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBufferChangedListener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IBufferFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IClasspathEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeAssist.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeCompletionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICodeFormatter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICompletionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ICorrectionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IElementChangedListener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IImportContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IImportDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJarEntryResource.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaElementDelta.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModel.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelMarker.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatus.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaModelStatusConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IJavaProject.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ILocalVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMember.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMemberValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModularClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IModuleDescription.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IOpenable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IOrdinaryClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IPackageFragmentRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IParent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IProblemRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IRegion.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceManipulation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceRange.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ISourceReference.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeHierarchy.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeHierarchyChangedListener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ITypeRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/IWorkingCopy.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaConventions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaModelException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/NamingConventions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Signature.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/SourceRange.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/ToolFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/WorkingCopyOwner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/BuildContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/CompilationParticipant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/IScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ITerminalSymbols.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/compiler/ReconcileContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/ICodeSnippetRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/IEvaluationContext.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/IGlobalVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/eval/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/DOMException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/DOMFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMCompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMImport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMMember.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMNode.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMPackage.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/IDOMType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/jdom/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/provisional/JavaModelAccess.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ByteCodeVisitorAdapter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFileBytesDisassembler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ClassFormatException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/CompilationUnitSorter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ExternalAnnotationUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationComponentValue.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAnnotationDefaultAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IAttributeNamesConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBootstrapMethodsEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IBytecodeVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileDisassembler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IClassFileReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ICodeAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IComponentInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPool.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolConstant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantPoolEntry3.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IConstantValueAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IEnclosingMethodAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExceptionAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExceptionTableEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IExtendedAnnotationConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IFieldInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IInnerClassesAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IInnerClassesAttributeEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILineNumberAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableReferenceInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableTableEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ILocalVariableTypeTableEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IMethodParametersAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModifierConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModuleAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModuleMainClassAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IModulePackagesAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestHostAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMemberAttributeEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/INestMembersAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IOpcodeMnemonics.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPackageVisibilityInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IParameterAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IPermittedSubclassesAttributeEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IProvidesInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRecordAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRequiresInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleParameterAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeInvisibleTypeAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleParameterAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IRuntimeVisibleTypeAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ISignatureAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/ISourceAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IStackMapAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IStackMapFrame.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IStackMapTableAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/IVerificationTypeInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/OpcodeStringValues.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/core/util/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ExtraFlags.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/IDocumentElementRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ISourceElementRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementRequestorAdapter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/TypeConverter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ASTHolderCUInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AbstractClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AbstractModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AnnotatableInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Annotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/AnnotationInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BasicCompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BatchInitializationMonitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BatchOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BecomeWorkingCopyOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryLambdaExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryLambdaMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryRecordComponent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Buffer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferFactoryWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BufferManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableNameEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CancelableProblemFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ChangeClasspathOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileWorkingCopy.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAccessRule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathValidation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CommitWorkingCopyOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationGroup.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CompilationUnitStructureRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyPackageFragmentRootOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CopyResourceElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateCompilationUnitOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateElementInCUOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateFieldOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateImportOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateInitializerOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateMethodOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreatePackageDeclarationOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreatePackageFragmentOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeHierarchyOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeMemberOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/CreateTypeOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DefaultWorkingCopyOwner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeletePackageFragmentRootOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeleteResourceElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DiscardWorkingCopyOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DocumentAdapter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DynamicProjectReferences.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ElementCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalAnnotationTracker.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFolderChange.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalJavaProject.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalPackageFragmentRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/IJavaElementRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INameEnvironmentWithProgress.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/INamingRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/IPathRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportContainerInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ImportDeclarationElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Initializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/InitializerElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/InitializerWithChildrenInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/InternalNamingConventions.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JModPackageFragmentRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarEntryDirectory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarEntryFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarEntryResource.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JarPackageFragmentRootInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceModifyListener.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDelta.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementDeltaBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElementRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModel.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelStatus.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProjectElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavadocContents.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JrtPackageFragmentRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LRUCacheEnumerator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LambdaExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LambdaFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LambdaMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/LocalVariable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Member.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MemberElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MemberValuePair.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModelUpdater.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModularClassFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Module.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModuleDescriptionInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModulePathContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModulePathContainerInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModuleSourcePathManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ModuleUpdater.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MoveElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MovePackageFragmentRootOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MoveResourceElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/MultiOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NameLookup.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NamedMember.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NonJavaResource.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/NullBuffer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Openable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/OpenableElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/OverflowingLRUCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageDeclaration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRoot.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragmentRootInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ProjectEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ReconcileWorkingCopyOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/Region.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/RenameElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/RenameResourceElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedBinaryType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedLambdaExpression.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedSourceField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedSourceMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ResolvedSourceType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SearchableEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SearchableEnvironmentRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetClasspathOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetContainerOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SetVariablesOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SimpleDelta.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SingleTypeRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SortElementsOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceAnnotationMethodInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceConstructorInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceConstructorWithChildrenInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceFieldElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceFieldWithChildrenInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceMethodWithChildrenInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceModule.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceRefElement.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceRefElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SourceTypeElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeParameterElementInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/TypeVector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibrary.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryClasspathContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryClasspathContainerInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/UserLibraryManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/VerboseElementCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/XMLWriter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbortIncrementalBuildException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/AdditionalTypeCollection.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BatchImageBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/BuildNotifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathDirectory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJMod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJar.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrt.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathJrtWithReleaseOption.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathLocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiDirectory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ClasspathMultiReleaseJar.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/CompilationParticipantResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/CompressedReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/CompressedWriter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ICompilationUnitLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ImageBuilderInternalException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/MissingSourceFileException.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ModuleEntryProcessor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ModuleInfoBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ModulePathEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/NameSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ProblemFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/QualifiedNameSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/ReferenceCollection.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/SourceFile.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/State.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/StringSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/WorkQueue.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/eval/EvaluationContextWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/eval/GlobalVariableWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/eval/RequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/BindingMap.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/ChangeCollector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyResolver.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/IndexBasedHierarchyBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/RegionBasedHierarchyBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/RegionBasedTypeHierarchy.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/TypeHierarchy.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/AbstractDOMBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/CompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMCompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMField.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMImport.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMInitializer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMMember.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMMethod.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMNode.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMPackage.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/DOMType.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/ILineStartFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SiblingEnumeration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/jdom/SimpleDOMBuilder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ASTNodeFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Annotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponent.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationComponentValue.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/AnnotationDefaultAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BindingKeyResolver.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/BootstrapMethodsEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CharArrayBuffer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileReader.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ClassFileStruct.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CodeSnippetParsingUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/CommentRecorderParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ComponentInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPool.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantPoolEntry2.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ConstantValueAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DOMFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DeduplicationUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultBytecodeVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/DefaultStackMapFrame.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Disassembler.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/EnclosingMethodAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExceptionTableEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ExtendedAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/FieldInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HandleFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HashSetOfArray.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HashSetOfCharArrayArray.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/HashtableOfArrayToObject.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ICacheEnumeration.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ILRUCacheable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/InnerClassesAttributeEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/JavaElementFinder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/KeyKind.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/KeyToSignature.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LRUCache.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LineNumberAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableReferenceInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTableEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/LocalVariableTypeTableEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MementoTokenizer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Messages.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/MethodParametersAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleMainClassAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModulePackagesAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ModuleUtil.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestHostAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/NestMembersAttributeEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PackageVisibilityInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ParameterAnnotation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PermittedSubclassesAttributeEntry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ProvidesInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/PublicScanner.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RecordAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RecordedParsingInformation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ReferenceInfoAdapter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RequiresInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ResourceCompilationUnit.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleParameterAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeInvisibleTypeAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleParameterAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/RuntimeVisibleTypeAnnotationsAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SignatureAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleDocument.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SimpleWordSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/SourceFileAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapFrame.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/StackMapTableAttribute.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/ToStringSorter.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/Util.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/VerificationInfo.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/WeakHashSetOfCharArray.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/util/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/API_changes.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R20_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R21_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R30_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R31_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R32_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R33_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R34_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R35_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R36_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/R37_buildnotes_jdt-core.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/notes/porting_guide.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/plugin.jars create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/plugin.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/plugin.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/pom.bak create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/pom.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/annotationProcessorManager.exsd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/classpathContainerInitializer.exsd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/classpathVariableInitializer.exsd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/codeFormatter.exsd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/compilationParticipant.exsd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/compiler.dtd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/schema/javaFormatter.exsd create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/GenerateBuildScript$1.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/GenerateBuildScript$2.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/GenerateBuildScript.class create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/GenerateBuildScript.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/GenerateParserScript.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/about.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/antadapter/META-INF/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/antadapter/plugin.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/antadapter/plugin.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/binary/META-INF/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/build-parser.launch create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/build-parser.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/build.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/build_ecj.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/ecj.1 create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/export-ecj.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/export-ejavac.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/export-ejavac2.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/export-ejavac2_linux.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/export-ejavac_linux.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/exportplugin.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/ikvm_script.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/oldexportplugin.xml create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/scripts/source/META-INF/MANIFEST.MF create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/JavaIndexerApplication.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/messages.properties create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/index/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/FieldReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchResultCollector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IJavaSearchScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/IParallelizable.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ISearchPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ITypeNameRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/LocalVariableReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameMatchRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodNameRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/MethodReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ModuleDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ModuleReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/PackageReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/ReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchDocument.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchEngine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchParticipant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/SearchRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameMatchRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeNameRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterDeclarationMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeParameterReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/TypeReferenceMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/core/search/package.html create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/DiskIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/EntryResult.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/FileIndexLocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/Index.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/IndexLocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/IndexQualifier.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/JarIndexLocation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/MemoryIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/index/MetaIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleDescriptor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryModuleFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeDescriptor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/java/model/BinaryTypeFactory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/nd/util/CharArrayUtils.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/AbstractJavaSearchScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/AbstractSearchScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/BasicSearchEngine.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/HierarchyScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessConstructorRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessMethodRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IRestrictedAccessTypeRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexQueryRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/IndexSelector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchDocument.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchMethodNameMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchParticipant.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchTypeNameMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaWorkspaceScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameMatchRequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/MethodNameRequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/NameMatchRequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PathCollector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/PatternSearchJob.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/StringOperation.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/SubTypeSearchJob.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameMatchRequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/TypeNameRequestorWrapper.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/UnindexedSearchScope.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AbstractIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddFolderToIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJarFileToIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/AddJrtToIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryContainer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/DefaultJavaIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IIndexConstants.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexAllProject.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexBinaryFolder.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexManager.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexNamesRegistry.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexRequest.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/IndexingParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/ManifestIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/QualifierQuery.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/ReadWriteMonitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/RemoveFolderFromIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/RemoveFromIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SaveIndex.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexer.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/SourceIndexerRequestor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/AndPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClasspathSourceDirectory.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfAccessedFieldsPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedMethodsPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/DeclarationOfReferencedTypesPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/FieldPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ImportMatchLocatorParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IndexBasedJavaSearchEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/IntersectingPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchNameEnvironment.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/JavaSearchPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariableLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/LocalVariablePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocatorParser.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchingNodeSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MemberDeclarationVisitor.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModularClassFileMatchLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModuleLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ModulePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MultiTypeDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/OrPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferenceLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PackageReferencePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PatternLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PossibleMatch.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/PossibleMatchSet.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SecondaryTypeDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeNamesCollector.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferenceLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/SuperTypeReferencePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeParameterPattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferenceLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeReferencePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariableLocator.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/VariablePattern.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/IJob.java create mode 100644 jdt-patch/e425/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/processing/JobManager.java create mode 100644 jdt-patch/e425/tests-pom/pom.xml diff --git a/docs/Getting-Started-with-Groovy-Eclipse-Source-Code.md b/docs/Getting-Started-with-Groovy-Eclipse-Source-Code.md index d18281c1e5..a1db067eb8 100644 --- a/docs/Getting-Started-with-Groovy-Eclipse-Source-Code.md +++ b/docs/Getting-Started-with-Groovy-Eclipse-Source-Code.md @@ -167,7 +167,7 @@ This minimal project set should be open in your workspace: * org.eclipse.jdt.groovy.core.tests.builder * org.eclipse.jdt.groovy.core.tests.compiler -Note: Only one JDT patch should be imported (`org.eclipse.jdt.core`, `org.eclipse.jdt.core.tests.builder`, `org.eclipse.jdt.core.tests.compiler`) and it should be matched to the target platform of your workspace. For example, the patch in the `/e424` folder is for Eclipse 4.24 (2022-06). +Note: Only one JDT patch should be imported (`org.eclipse.jdt.core`, `org.eclipse.jdt.core.tests.builder`, `org.eclipse.jdt.core.tests.compiler`) and it should be matched to the target platform of your workspace. For example, the patch in the `/e425` folder is for Eclipse 4.25 (2022-09). ## Test with Eclipse @@ -185,14 +185,15 @@ For manual testing and debugging, right-click on the org.codehaus.groovy.eclipse [Download and install Maven](https://maven.apache.org/). -From the root directory of the repository, execute the following command to build Groovy-Eclipse for Eclipse 4.24 (2022-06). +From the root directory of the repository, execute the following command to build Groovy-Eclipse for Eclipse 4.25 (2022-09). ``` - mvn -Pe4.24 clean install + mvn -Pe4.25 clean install ``` -Replace e4.24 with a different option to build it for another Eclipse version: +Replace e4.25 with a different option to build it for another Eclipse version: +* e4.24 * e4.23 * e4.22 * e4.21 diff --git a/groovy-eclipse.setup b/groovy-eclipse.setup index 4ed9202f32..8f8452ac04 100644 --- a/groovy-eclipse.setup +++ b/groovy-eclipse.setup @@ -75,9 +75,12 @@ + @@ -93,9 +96,6 @@ - Choose the compatibility level of the target platform + filter="(| (scope.product.version.name=2022-09) (scope.product.version.name=latest))"> + + + + - - - - + + + @@ -266,13 +273,6 @@ rootFolder="${git.clone.Groovy-Eclipse.location}/jdt-patch/e420" locateNestedProjects="true"/> - - - + + + + + - - - - + + Feature-org.codehaus.groovy.jdt.patch + + + org.eclipse.pde.FeatureBuilder + + + + org.eclipse.pde.FeatureNature + + diff --git a/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/build.properties b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/build.properties new file mode 100644 index 0000000000..8003cbc57e --- /dev/null +++ b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/build.properties @@ -0,0 +1,3 @@ +bin.includes = feature.properties,\ + feature.xml,\ + *.html diff --git a/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.properties b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.properties new file mode 100644 index 0000000000..4139a8ea90 --- /dev/null +++ b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.properties @@ -0,0 +1,124 @@ +# contains externalized strings for feature.xml +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%foo" in feature.xml corresponds to the key "foo" in this file + +providerName=Pivotal Software, Inc. + +featureName=Eclipse JDT Core patch for Groovy + +descriptionURL=https://github.com/groovy/groovy-eclipse/wiki + +description=This JDT Core patch provides Groovy integration with the JDT and the Java compiler. + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ +March 17, 2005\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ +is provided to you under the terms and conditions of the Eclipse Public\n\ +License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ +Content and is also available at https://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse.org CVS\n\ +repository ("Repository") in CVS modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +Features may also include other Features ("Included Features"). Files named\n\ +"feature.xml" may contain a list of the names and version numbers of\n\ +Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Eclipse Update Manager, you must agree to a license ("Feature Update\n\ +License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties". Such Abouts,\n\ +Feature Licenses and Feature Update Licenses contain the terms and\n\ +conditions (or references to such terms and conditions) that govern your\n\ +use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Common Public License Version 1.0 (available at https://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at https://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at https://www.apache.org/licenses/LICENSE-2.0)\n\ + - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at https://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use,\n\ +and re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n +########### end of license property ########################################## + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2009-2022 Pivotal Software, Inc. and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +https://www.eclipse.org/legal/epl-v10.html\n\ diff --git a/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.xml b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.xml new file mode 100644 index 0000000000..9d6002130a --- /dev/null +++ b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/feature.xml @@ -0,0 +1,32 @@ + + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + diff --git a/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/license.html b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/license.html new file mode 100644 index 0000000000..25120c431e --- /dev/null +++ b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/license.html @@ -0,0 +1,109 @@ + + + + +Eclipse.org Software User Agreement +

Eclipse Foundation Software User Agreement

+

March 17, 2005

+ +

Usage Of Content

+ +

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

+ +

Applicable Licenses

+ +

Unless otherwise indicated, all Content made available by the +Eclipse Foundation is provided to you under the terms and conditions of +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is +provided with this Content and is also available at https://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

+ +

Content includes, but is not limited to, source code, object code, +documentation and other files maintained in the Eclipse.org CVS +repository ("Repository") in CVS modules ("Modules") and made available +as downloadable archives ("Downloads").

+ +
    +
  • Content may be structured and packaged into modules to +facilitate delivering, extending, and upgrading the Content. Typical +modules may include plug-ins ("Plug-ins"), plug-in fragments +("Fragments"), and features ("Features").
  • +
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • +
  • A +Feature is a bundle of one or more Plug-ins and/or Fragments and +associated material. Each Feature may be packaged as a sub-directory in +a directory named "features". Within a Feature, files named +"feature.xml" may contain a list of the names and version numbers of +the Plug-ins and/or Fragments associated with that Feature.
  • +
  • Features +may also include other Features ("Included Features"). Within a +Feature, files named "feature.xml" may contain a list of the names and +version numbers of Included Features.
  • +
+ +

The terms and conditions governing Plug-ins and Fragments should be +contained in files named "about.html" ("Abouts"). The terms and +conditions governing Features and +Included Features should be contained in files named "license.html" +("Feature Licenses"). Abouts and Feature Licenses may be located in any +directory of a Download or Module +including, but not limited to the following locations:

+ +
    +
  • The top-level (root) directory
  • +
  • Plug-in and Fragment directories
  • +
  • Inside Plug-ins and Fragments packaged as JARs
  • +
  • Sub-directories of the directory named "src" of certain Plug-ins
  • +
  • Feature directories
  • +
+ +

Note: if a Feature made available by the Eclipse Foundation is +installed using the Eclipse Update Manager, you must agree to a license +("Feature Update License") during the +installation process. If the Feature contains Included Features, the +Feature Update License should either provide you with the terms and +conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be +found in the "license" property of files named "feature.properties" +found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the +terms and conditions (or references to such terms and conditions) that +govern your use of the associated Content in +that directory.

+ +

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND +CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

+ + + +

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND +CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, +or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions +govern that particular Content.

+ +

Cryptography

+ +

Content may contain encryption software. The country in which you +are currently may have restrictions on the import, possession, and use, +and/or re-export to another country, of encryption software. BEFORE +using any encryption software, please check the country's laws, +regulations and policies concerning the import, possession, or use, and +re-export of encryption software, to see if this is permitted.

+ +Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. + \ No newline at end of file diff --git a/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/pom.xml b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/pom.xml new file mode 100644 index 0000000000..3ca290a9e1 --- /dev/null +++ b/jdt-patch/e425/Feature-org.codehaus.groovy.jdt.patch/pom.xml @@ -0,0 +1,13 @@ + + 4.0.0 + + ../../../pom.xml + org.codehaus.groovy.eclipse + org.codehaus.groovy.eclipse.parent + 4.7.0-SNAPSHOT + + org.codehaus.groovy.eclipse + org.codehaus.groovy.jdt.patch + 4.7.0-SNAPSHOT + eclipse-feature + \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.classpath b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.classpath new file mode 100644 index 0000000000..73d6894a61 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.gitignore b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.gitignore new file mode 100644 index 0000000000..934e0e06ff --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.gitignore @@ -0,0 +1,2 @@ +/bin +/target diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.project b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.project new file mode 100644 index 0000000000..06dcf605b1 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.project @@ -0,0 +1,26 @@ + + + org.eclipse.jdt.core.tests.builder + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.resources.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..99f26c0203 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.runtime.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000000..5a0ad22d2a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.core.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..c45edd09f5 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,99 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +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.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.ui.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..ab1a682988 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,62 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=false +sp_cleanup.remove_redundant_semicolons=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.update_ibm_copyright_to_current_year=true +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/META-INF/MANIFEST.MF b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..df4abd9e2f --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.jdt.core.tests.builder; singleton:=true +Bundle-Version: 3.11.200.qualifier +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Export-Package: org.eclipse.jdt.core.tests.builder +Require-Bundle: org.junit;bundle-version="3.8.1", + org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)", + org.eclipse.jdt.core.tests.compiler;bundle-version="[3.4.0,4.0.0)", + org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", + org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", + org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)", + org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional, + org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Eclipse-BundleShape: dir +Automatic-Module-Name: org.eclipse.jdt.core.tests.builder diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/about.html b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/about.html new file mode 100644 index 0000000000..164f781a8f --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/about.html @@ -0,0 +1,36 @@ + + + + +About + + +

About This Content

+ +

November 30, 2017

+

License

+ +

+ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at http://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +

+ +

+ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at http://www.eclipse.org. +

+ + + \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/build.properties b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/build.properties new file mode 100644 index 0000000000..ce74f2ba58 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/build.properties @@ -0,0 +1,24 @@ +############################################################################### +# Copyright (c) 2000, 2013 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 +# Red Hat Inc. (mistria) - Avoid nested jars +############################################################################### +bin.includes = plugin.xml,\ + test.xml,\ + about.html,\ + .,\ + META-INF/,\ + plugin.properties,\ + workspace/ +source.. = src/ +output.. = bin/ +src.includes=about.html diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/forceQualifierUpdate.txt b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/forceQualifierUpdate.txt new file mode 100644 index 0000000000..073841225f --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/forceQualifierUpdate.txt @@ -0,0 +1,2 @@ +# To force a version qualifier update, add the bug here +Bug 480835 - Failures in build due to changes not being picked up by tests diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.properties b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.properties new file mode 100644 index 0000000000..67609b5a82 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.properties @@ -0,0 +1,15 @@ +############################################################################### +# Copyright (c) 2000, 2006 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 +############################################################################### +providerName=Eclipse.org +pluginName=Java Builder Tests diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.xml b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.xml new file mode 100644 index 0000000000..bf08c103ed --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/plugin.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/pom.xml b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/pom.xml new file mode 100644 index 0000000000..7e75921d7a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/pom.xml @@ -0,0 +1,24 @@ + + + + 4.0.0 + + eclipse.jdt.core + tests-pom + 4.25.0-SNAPSHOT + ../tests-pom/ + + org.eclipse.jdt + org.eclipse.jdt.core.tests.builder + 3.11.200-SNAPSHOT + eclipse-plugin + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractLeakTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractLeakTest.java new file mode 100644 index 0000000000..9aa043fd8b --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractLeakTest.java @@ -0,0 +1,254 @@ +/******************************************************************************* + * Copyright (c) 2019 Andrey Loskutov 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: + * Andrey Loskutov - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.management.ManagementFactory; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +/** + * Base class for testing builder related opened file leak tests, see bug 543506 + */ +public abstract class AbstractLeakTest extends BuilderTests { + + static boolean WINDOWS; + static boolean LINUX; + static boolean MAC; + static boolean lsofCheckDone; + + static { + String os = System.getProperty("os.name").toLowerCase(); + WINDOWS = os.contains("windows"); + LINUX = os.contains("linux"); + MAC = os.contains("mac"); + } + + public AbstractLeakTest(String name) { + super(name); + } + + protected void testLeaksOnIncrementalBuild() throws Exception { + if(MAC) { + return; + } + internalTestUsedLibraryLeaks(IncrementalProjectBuilder.INCREMENTAL_BUILD); + } + + protected void testLeaksOnCleanBuild() throws Exception { + if(MAC) { + return; + } + internalTestUsedLibraryLeaks(IncrementalProjectBuilder.CLEAN_BUILD); + } + + protected void testLeaksOnFullBuild() throws Exception { + if(MAC) { + return; + } + internalTestUsedLibraryLeaks(IncrementalProjectBuilder.FULL_BUILD); + } + + private void internalTestUsedLibraryLeaks(int kind) throws Exception { + if(LINUX && !lsofCheckDone) { + selfTestLsof(); + } + + String projectName = getName(); + IPath projectPath = env.addProject(projectName, getCompatibilityLevel()); + env.setOutputFolder(projectPath, ""); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + IPath internalJar = addInternalJar(projectPath); + + createJavaFile(projectPath); + + switch (kind) { + case IncrementalProjectBuilder.CLEAN_BUILD: + cleanBuild(projectName); + assertNotLeaked(internalJar); + break; + case IncrementalProjectBuilder.FULL_BUILD: + fullBuild(projectPath); + assertNotLeaked(internalJar); + break; + case IncrementalProjectBuilder.INCREMENTAL_BUILD: + incrementalBuild(projectPath); + changeJavaFile(projectPath); + incrementalBuild(projectPath); + assertNotLeaked(internalJar); + break; + default: + fail("Unexpected build kind: " + kind); + } + } + + abstract String getCompatibilityLevel(); + + private IPath addInternalJar(IPath projectPath) throws IOException, JavaModelException { + IPath internalJar = addEmptyInternalJar(projectPath, "test.jar"); + return internalJar; + } + + private void createJavaFile(IPath projectPath) { + IPath path = env.addClass(projectPath, "a", "Other", + "package a;\n" + + "public class Other {\n" + + "}" + ); + IFile file = env.getWorkspace().getRoot().getFile(path); + assertTrue("File should exists: " + path, file.exists()); + } + + private void changeJavaFile(IPath projectPath) throws Exception { + IPath path = env.addClass(projectPath, "a", "Other", + "package a;\n" + + "public class Other {\n" + + " // an extra comment \n" + + "}" + ); + IFile file = env.getWorkspace().getRoot().getFile(path); + assertTrue("FIle should exists: " + path, file.exists()); + } + + private void assertNotLeaked(IPath path) throws Exception { + expectingNoProblems(); + IFile file = env.getWorkspace().getRoot().getFile(path); + assertTrue("FIle should exists: " + path, file.exists()); + if(WINDOWS) { + tryRemoveFile(file); + } else if (LINUX) { + checkOpenDescriptors(file); + } + } + + private void tryRemoveFile(IFile file) { + // Note: this is a lame attempt to check for leaked file descriptor + // This works on Windows only, because windows does not allow to delete + // files opened for reading. + // On Linux we need something like lsof -p | grep file name + try { + file.delete(true, null); + } catch (CoreException e) { + try { + // second attempt to avoid delays on teardown + Files.deleteIfExists(file.getLocation().toFile().toPath()); + } catch (Exception e2) { + file.getLocation().toFile().delete(); + // ignore + } + throw new IllegalStateException("File leaked during build: " + file, e); + } + assertFalse("File should be deleted: " + file, file.exists()); + } + + private void checkOpenDescriptors(IFile file) throws Exception { + runGcAndFInalization(); + List processes = getProcessesOpenedFile(Paths.get(file.getLocation().toOSString())); + if(!processes.isEmpty()) { + runGcAndFInalization(); + Thread.sleep(5000); + processes = getProcessesOpenedFile(Paths.get(file.getLocation().toOSString())); + if(!processes.isEmpty()) { + throw new IllegalStateException("File leaked during build: " + file); + } + } + } + + private void runGcAndFInalization() { + System.gc(); + System.runFinalization(); + System.gc(); + System.runFinalization(); + System.gc(); + System.runFinalization(); + } + + + private void selfTestLsof() throws Exception { + Path tempFile = Files.createTempFile("testLsof", "tmp"); + Files.deleteIfExists(tempFile); + Files.write(tempFile, "Hello\nselfTestLsof".getBytes()); + try(InputStream is = new FileInputStream(tempFile.toFile())){ + is.read(); + List list = getProcessesOpenedFile(tempFile); + assertEquals("lsof doesn't work in this environment!", 1, list.size()); + lsofCheckDone = true; + } + } + + private static List getProcessesOpenedFile(Path path) throws Exception { + int pid = getPid(); + // assertTrue("JVM PID must be > 0 : " + pid, pid > 0); + // -F n : to print only name column (note: all lines start with "n") + // -a : to "and" all following options + // -b :to avoid blocking calls + // -p : to select process with opened files + // List lines = readLsofLines("lsof -F n -a -p " + pid + " -b", true); + + // Code above seem to hang... + List lines = readLsofLines("lsof " + path, true); + for (String line : lines) { + if(line.contains("" + pid)) { + return lines; + } + } + return Collections.emptyList(); + } + + private static int getPid() throws Exception { + String jvmName = ManagementFactory.getRuntimeMXBean().getName(); + int indexOfAt = jvmName.indexOf('@'); + String pidSubstring = jvmName.substring(0, indexOfAt); + int pid = Integer.parseInt(pidSubstring); + return pid; + } + + private static List readLsofLines(String cmd, boolean skipFirst) throws Exception { + List lines = new ArrayList<>(); + Process process = Runtime.getRuntime().exec(cmd); + try (BufferedReader rdr = new BufferedReader(new InputStreamReader(process.getInputStream()))) { + if (skipFirst) { + rdr.readLine(); + } + String line; + while((line = rdr.readLine())!= null) { + // remove "n" prefix from lsof output + if(line.startsWith("n")) { + line = line.substring(1); + } + if(line.trim().length() > 1) { + lines.add(line); + } + } + } + lines.sort(null); + return lines; + } + +} \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java new file mode 100644 index 0000000000..2610aa75d8 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AbstractMethodTests.java @@ -0,0 +1,330 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; +import java.util.Comparator; + +import junit.framework.*; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IRegion; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.ToolFactory; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.core.util.IClassFileReader; +import org.eclipse.jdt.core.util.IMethodInfo; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class AbstractMethodTests extends BuilderTests { + private static final Comparator COMPARATOR = new Comparator() { + public int compare(Object o1, Object o2) { + IResource resource1 = (IResource) o1; + IResource resource2 = (IResource) o2; + String path1 = resource1.getFullPath().toString(); + String path2 = resource2.getFullPath().toString(); + int length1 = path1.length(); + int length2 = path2.length(); + + if (length1 != length2) { + return length1 - length2; + } + return path1.toString().compareTo(path2.toString()); + } + }; + + public AbstractMethodTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(AbstractMethodTests.class); + } + + /** + * Check behavior in 1.2 target mode (NO generated default abstract method) + */ + public void test001() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project1Path, ""); //$NON-NLS-1$ + + env.setOutputFolder(project1Path, "bin"); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(project1Path, "src"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "IX", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public interface IX {\n" + //$NON-NLS-1$ + " public abstract void foo(IX x);\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath classX = env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + " public void foo(IX x){}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project2Path, ""); //$NON-NLS-1$ + + IPath root2 = env.addPackageFragmentRoot(project2Path, "src"); //$NON-NLS-1$ + env.setOutputFolder(project2Path, "bin"); //$NON-NLS-1$ + + IPath classY =env.addClass(root2, "p3", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n" + //$NON-NLS-1$ + "import p2.*;\n" + //$NON-NLS-1$ + "public class Y extends X{\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + " public void foo(I__X x){}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingOnlySpecificProblemFor(classX, new Problem("X.foo(I__X)", "I__X cannot be resolved to a type", classX, 84, 88, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingOnlySpecificProblemFor(classY, new Problem("Y", "The type Y must implement the inherited abstract method IX.foo(IX)", classY, 38, 39, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + //---------------------------- + // Step 3 + //---------------------------- + env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + " public void foo(IX x){}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + } + + /** + * Check behavior in 1.1 target mode (generated default abstract method) + */ + public void test002() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + env.getJavaProject(project1Path).setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1); // need default abstract method + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project1Path, ""); //$NON-NLS-1$ + + env.setOutputFolder(project1Path, "bin"); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(project1Path, "src"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "IX", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public interface IX {\n" + //$NON-NLS-1$ + " public abstract void foo(IX x);\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath classX = env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + " public void foo(IX x){}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project2Path, ""); //$NON-NLS-1$ + + IPath root2 = env.addPackageFragmentRoot(project2Path, "src"); //$NON-NLS-1$ + env.setOutputFolder(project2Path, "bin"); //$NON-NLS-1$ + + IPath classY =env.addClass(root2, "p3", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n" + //$NON-NLS-1$ + "import p2.*;\n" + //$NON-NLS-1$ + "public class Y extends X{\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + " public void foo(I__X x){}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingOnlySpecificProblemFor(classX, new Problem("X.foo(I__X)", "I__X cannot be resolved to a type", classX, 84, 88, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingOnlySpecificProblemFor(classY, new Problem("Y", "The type Y must implement the inherited abstract method IX.foo(IX)", classY, 38, 39, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + //---------------------------- + // Step 3 + //---------------------------- + env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + " public void foo(IX x){}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + } + + /** + * Check behavior in 1.1 target mode (generated default abstract method) + */ + public void test003() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + env.getJavaProject(project1Path).setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_1); // need default abstract method + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project1Path, ""); //$NON-NLS-1$ + + env.setOutputFolder(project1Path, "bin"); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(project1Path, "src"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "IX", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public interface IX {\n" + //$NON-NLS-1$ + " public abstract void foo(IX x);\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root1, "p2", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "public abstract class X implements IX {\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + IJavaProject project = env.getJavaProject(project1Path); + IRegion region = JavaCore.newRegion(); + region.add(project); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = "/Project1/bin/p2/X.class\n" + + "/Project1/bin/p1/IX.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + assertEquals("Wrong type", IResource.FILE, resources[0].getType()); + IFile classFile = (IFile) resources[0]; + IClassFileReader classFileReader = null; + InputStream stream = null; + try { + stream = classFile.getContents(); + classFileReader = ToolFactory.createDefaultClassFileReader(stream, IClassFileReader.ALL); + } catch (CoreException e) { + e.printStackTrace(); + } finally { + if (stream != null) { + try { + stream.close(); + } catch(IOException e) { + // ignore + } + } + } + assertNotNull("No class file reader", classFileReader); + IMethodInfo[] methodInfos = classFileReader.getMethodInfos(); + IMethodInfo found = null; + loop: for (int i = 0, max = methodInfos.length; i < max; i++) { + IMethodInfo methodInfo = methodInfos[i]; + if (CharOperation.equals(methodInfo.getName(), "foo".toCharArray())) { + found = methodInfo; + break loop; + } + } + assertNotNull("No method found", found); + assertTrue("Not a synthetic method", found.isSynthetic()); + } + + private String getResourceOuput(IResource[] resources) { + StringWriter stringWriter = new StringWriter(); + PrintWriter writer = new PrintWriter(stringWriter); + for (int i = 0, max = resources.length; i < max; i++) { + writer.println(resources[i].getFullPath().toString()); + } + writer.flush(); + writer.close(); + return Util.convertToIndependantLineDelimiter(String.valueOf(stringWriter)); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AnnotationDependencyTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AnnotationDependencyTests.java new file mode 100644 index 0000000000..00d77894b7 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/AnnotationDependencyTests.java @@ -0,0 +1,1670 @@ +/******************************************************************************* + * Copyright (c) 2009, 2014 Walter Harley 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: + * Walter Harley (eclipse@cafewalter.com) - initial implementation + * IBM Corporation - initial API and implementation + * Stephan Herrmann - Contributions for + * bug 365992 - [builder] [null] Change of nullness for a parameter doesn't trigger a build for the files that call the method + * Bug 392099 - [1.8][compiler][null] Apply null annotation on types for null analysis + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.File; +import junit.framework.Test; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; +import org.osgi.framework.Bundle; + +/** + * Tests to verify that annotation changes cause recompilation of dependent types. + * See http://bugs.eclipse.org/149768 + */ +public class AnnotationDependencyTests extends BuilderTests { + private IPath srcRoot = null; + private IPath projectPath = null; + + public AnnotationDependencyTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(AnnotationDependencyTests.class); + } + + public void setUp() throws Exception { + super.setUp(); + + this.projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(this.projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(this.projectPath,""); //$NON-NLS-1$ + + this.srcRoot = env.addPackageFragmentRoot(this.projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(this.projectPath, "bin"); //$NON-NLS-1$ + } + + protected void tearDown() throws Exception { + this.projectPath = null; + this.srcRoot = null; + + super.tearDown(); + } + + private void addAnnotationType() { + String annoCode = "package p1;\n" + + "@interface Anno {\n" + + "String value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "Anno", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoInt {\n" + + "int value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoInt", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoBoolean {\n" + + "boolean value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoBoolean", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoByte {\n" + + "byte value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoByte", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoChar {\n" + + "char value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoChar", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoShort {\n" + + "short value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoShort", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoDouble {\n" + + "double value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoDouble", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoFloat {\n" + + "float value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoFloat", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoLong {\n" + + "long value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoLong", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoStringArray {\n" + + "String[] value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoStringArray", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoAnnotation {\n" + + "AnnoLong value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoAnnotation", annoCode); + annoCode = "package p1;\n" + + "enum E {\n" + + "A, B, C\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "E", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoEnum {\n" + + "E value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoEnum", annoCode); + annoCode = "package p1;\n" + + "@interface AnnoClass {\n" + + "Class value();\n" + + "}\n"; + env.addClass(this.srcRoot, "p1", "AnnoClass", annoCode); + } + + void setupProjectForNullAnnotations() throws JavaModelException { + // add the org.eclipse.jdt.annotation library (bin/ folder or jar) to the project: + Bundle[] bundles = Platform.getBundles("org.eclipse.jdt.annotation","[1.1.0,2.0.0)"); + File bundleFile = FileLocator.getBundleFileLocation(bundles[0]).get(); + String annotationsLib = bundleFile.isDirectory() ? bundleFile.getPath()+"/bin" : bundleFile.getPath(); + IJavaProject javaProject = env.getJavaProject(this.projectPath); + IClasspathEntry[] rawClasspath = javaProject.getRawClasspath(); + int len = rawClasspath.length; + System.arraycopy(rawClasspath, 0, rawClasspath = new IClasspathEntry[len+1], 0, len); + rawClasspath[len] = JavaCore.newLibraryEntry(new Path(annotationsLib), null, null); + javaProject.setRawClasspath(rawClasspath, null); + + javaProject.setOption(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); + } + + /** + * This test makes sure that changing an annotation on type A causes type B + * to be recompiled, if B references A. See http://bugs.eclipse.org/149768 + */ + public void testTypeAnnotationDependency() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@Anno(\"A1\")" + "\n" + + "public class A {}"; + String a2Code = "package p1; " + "\n" + + "@Anno(\"A2\")" + "\n" + + "public class A {}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + + /** + * This test makes sure that changing an annotation on a field within type A + * causes type B to be recompiled, if B references A. + * See http://bugs.eclipse.org/149768 + */ + public void testFieldAnnotationDependency() throws Exception + { + String a1Code = "package p1; " + "\n" + + "public class A {" + "\n" + + " @Anno(\"A1\")" + "\n" + + " protected int f;" + "\n" + + "}"; + String a2Code = "package p1; " + "\n" + + "public class A {" + "\n" + + " @Anno(\"A2\")" + "\n" + + " protected int f;" + "\n" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + + /** + * This test makes sure that changing an annotation on a method within type A + * causes type B to be recompiled, if B references A. + * See http://bugs.eclipse.org/149768 + */ + public void testMethodAnnotationDependency() throws Exception + { + String a1Code = "package p1; " + "\n" + + "public class A {" + "\n" + + " @Anno(\"A1\")" + "\n" + + " protected int f() { return 0; }" + "\n" + + "}"; + String a2Code = "package p1; " + "\n" + + "public class A {" + "\n" + + " @Anno(\"A2\")" + "\n" + + " protected int f() { return 0; }" + "\n" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + + /** + * This test makes sure that changing an annotation on an inner type X within type A + * causes type B to be recompiled, if B references A. + * Note that B does not directly reference A.X, only A. + * See http://bugs.eclipse.org/149768 + */ + public void testInnerTypeAnnotationDependency() throws Exception + { + String a1Code = "package p1; " + "\n" + + "public class A {" + "\n" + + " @Anno(\"A1\")" + "\n" + + " public class X { }" + "\n" + + "}"; + String a2Code = "package p1; " + "\n" + + "public class A {" + "\n" + + " @Anno(\"A2\")" + "\n" + + " public class X { }" + "\n" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.A$X", "p1.B" }); + } + + /** + * This test makes sure that changing an annotation on a type A + * does not cause type B to be recompiled, if B does not reference A. + * See http://bugs.eclipse.org/149768 + */ + public void testUnrelatedTypeAnnotationDependency() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@Anno(\"A1\")" + "\n" + + "public class A {}"; + String a2Code = "package p1; " + "\n" + + "@Anno(\"A2\")" + "\n" + + "public class A {}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was not recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=214948 + public void testPackageInfoDependency() throws Exception { + String notypes = "@question.SimpleAnnotation(\"foo\") package notypes;"; + String question = "package question;"; + String deprecatedQuestion = "@Deprecated package question;"; + String SimpleAnnotation = "package question; " + "\n" + + "public @interface SimpleAnnotation { String value(); }"; + + IPath notypesPath = env.addClass( this.srcRoot, "notypes", "package-info", notypes ); + env.addClass( this.srcRoot, "question", "package-info", question ); + env.addClass( this.srcRoot, "question", "SimpleAnnotation", SimpleAnnotation ); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + env.addClass( this.srcRoot, "question", "package-info", deprecatedQuestion ); + incrementalBuild( this.projectPath ); + expectingOnlySpecificProblemFor(notypesPath, new Problem("", "The type SimpleAnnotation is deprecated", notypesPath, 10, 26, CategorizedProblem.CAT_DEPRECATION, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ + + env.addClass( this.srcRoot, "question", "package-info", question ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency2() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@Anno(\"A1\")" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@Anno(\"A1\")" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency3() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoInt(24)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoInt(24)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency4() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoByte(3)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoByte(3)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency5() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoBoolean(true)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoBoolean(true)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency6() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoChar('c')" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoChar('c')" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency7() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoDouble(1.0)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoDouble(1.0)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency8() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoFloat(1.0f)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoFloat(1.0f)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency9() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoLong(1L)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoLong(1L)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency10() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoShort(3)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoShort(3)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency11() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoStringArray({\"A1\",\"A2\"})" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoStringArray({\"A1\",\"A2\"})" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency12() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoAnnotation(@AnnoLong(3))" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoAnnotation(@AnnoLong(3))" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency13() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoEnum(E.A)\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoEnum(E.A)\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency14() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoClass(Object.class)\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoClass(Object.class)\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was NOT recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency15() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@Anno(\"A1\")" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@Anno(\"A2\")" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency16() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoInt(3)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoInt(4)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency17() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoByte(3)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoByte(4)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B"}); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency18() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoBoolean(true)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoBoolean(false)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency19() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoChar('c')" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoChar('d')" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency20() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoDouble(1.0)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoDouble(2.0)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency21() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoFloat(1.0f)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoFloat(2.0f)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency22() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoLong(1L)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoLong(2L)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency23() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoShort(3)" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoShort(5)" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency24() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoStringArray({\"A1\",\"A2\"})" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoStringArray({\"A2\",\"A1\"})" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency25() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoAnnotation(@AnnoLong(3))" + "\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoAnnotation(@AnnoLong(4))" + "\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency26() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoEnum(E.A)\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoEnum(E.C)\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=317841 + */ + public void testTypeAnnotationDependency27() throws Exception + { + String a1Code = "package p1; " + "\n" + + "@AnnoClass(Object.class)\n" + + "public class A {\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String a2Code = "package p1; " + "\n" + + "@AnnoClass(String.class)\n" + + "public class A {\n" + + "\n" + + " public void foo() {\n" + + " System.out.println(\"test\");" + + " }" + + "}"; + String bCode = "package p1; " + "\n" + + "public class B {" + "\n" + + " public A a;" + "\n" + + "}"; + + env.addClass( this.srcRoot, "p1", "A", a1Code ); + env.addClass( this.srcRoot, "p1", "B", bCode ); + addAnnotationType(); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit annotation in A + env.addClass( this.srcRoot, "p1", "A", a2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that B was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.A", "p1.B" }); + } + + // Bug 365992 - [builder] [null] Change of nullness for a parameter doesn't trigger a build for the files that call the method + public void testParameterAnnotationDependency01() throws JavaModelException { + // prepare the project: + setupProjectForNullAnnotations(); + + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(null);\n" + + " }\n" + + "}"; + String test2Code = "package p1;\n" + + "public class Test2 {\n" + + " public void bar(String str) {}\n" + + "}"; + + IPath test1Path = env.addClass( this.srcRoot, "p1", "Test1", test1Code ); + env.addClass( this.srcRoot, "p1", "Test2", test2Code ); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit Test2 to add @NonNull annotation (changes number of annotations) + String test2CodeB = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class Test2 {\n" + + " public void bar(@NonNull String str) {}\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test2", test2CodeB ); + incrementalBuild( this.projectPath ); + expectingProblemsFor(test1Path, + "Problem : Null type mismatch: required \'@NonNull String\' but the provided value is null [ resource :
range : <81,85> category : <90> severity : <2>]"); + + // verify that Test1 was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test2" }); + + // fix error by changing to @Nullable (change is only in an annotation name) + String test2CodeC = "package p1;\n" + + "import org.eclipse.jdt.annotation.Nullable;\n" + + "public class Test2 {\n" + + " public void bar(@Nullable String str) {}\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test2", test2CodeC ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that Test1 was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test2" }); + } + + // Bug 365992 - [builder] [null] Change of nullness for a parameter doesn't trigger a build for the files that call the method + // Bug 366341 - Incremental compiler fails to detect right scope for annotation related code changes + public void testReturnAnnotationDependency01() throws JavaModelException { + // prepare the project: + setupProjectForNullAnnotations(); + + String test1Code = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class Test1 {\n" + + " public @NonNull Object foo() {\n" + + " return new Test2().bar();\n" + + " }\n" + + "}"; + String test2Code = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class Test2 {\n" + + " public @NonNull Object bar() { return this; }\n" + + "}"; + + IPath test1Path = env.addClass( this.srcRoot, "p1", "Test1", test1Code ); + env.addClass( this.srcRoot, "p1", "Test2", test2Code ); + + fullBuild( this.projectPath ); + expectingNoProblems(); + + // edit Test2 to replace annotation + String test2CodeB = "package p1;\n" + + "import org.eclipse.jdt.annotation.Nullable;\n" + + "public class Test2 {\n" + + " public @Nullable Object bar() { return null; }\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test2", test2CodeB ); + incrementalBuild( this.projectPath ); + expectingProblemsFor(test1Path, + "Problem : Null type mismatch: required \'@NonNull Object\' but the provided value is specified as @Nullable [ resource : range : <126,143> category : <90> severity : <2>]"); + + // verify that Test1 was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test2" }); + + // remove annotation, error changes from can be null to unknown nullness + String test2CodeC = "package p1;\n" + + "public class Test2 {\n" + + " public Object bar() { return null; }\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test2", test2CodeC ); + incrementalBuild( this.projectPath ); + expectingProblemsFor(test1Path, + "Problem : Null type safety: The expression of type 'Object' needs unchecked conversion to conform to \'@NonNull Object\' [ resource : range : <126,143> category : <90> severity : <1>]"); + + // verify that Test1 was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test2" }); + + // back to initial OK version (re-add @NonNull annotation) + env.addClass( this.srcRoot, "p1", "Test2", test2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that Test1 was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test2" }); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=373571 + // incremental build that uses binary type for Test1 should not report spurious null errors. + public void testReturnAnnotationDependency02() throws JavaModelException { + // prepare the project: + setupProjectForNullAnnotations(); + + String test1Code = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNullByDefault;\n" + + "@NonNullByDefault\n" + + "public class Test1 {\n" + + " public void doStuff(int i) {\n" + + " }\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test1", test1Code ); + fullBuild( this.projectPath ); + expectingNoProblems(); + + // add Test2 + String test2Code = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNullByDefault;\n" + + "@NonNullByDefault\n" + + "public class Test2 extends Test1{\n" + + " @Override\n" + + " public void doStuff(int i) {\n" + + " super.doStuff(i);\n" + + " }\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test2", test2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that Test2 only was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test2" }); + + // edit Test2 to delete annotation + test2Code = "package p1;\n" + + "public class Test2 extends Test1{\n" + + " @Override\n" + + " public void doStuff(int i) {\n" + + " super.doStuff(i);\n" + + " }\n" + + "}"; + env.addClass( this.srcRoot, "p1", "Test2", test2Code ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + // verify that Test2 only was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test2" }); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=411771 + //[compiler][null] Enum constants not recognized as being NonNull. + //This test case exposes the bug mentioned in the defect. The enum + //definition comes from a file different from where it is accessed. + public void test411771a() throws JavaModelException { + setupProjectForNullAnnotations(); + String testEnumCode = "package p1;\n" + + "enum TestEnum {FOO };\n"; + env.addClass( this.srcRoot, "p1", "TestEnum", testEnumCode ); + fullBuild( this.projectPath ); + expectingNoProblems(); + + String nullTestCode = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class NullTest {\n" + + " public static TestEnum bla() {\n" + + " @NonNull final TestEnum t = TestEnum.FOO;\n" + + " return t;\n" + + " }\n" + + "}"; + env.addClass( this.srcRoot, "p1", "NullTest", nullTestCode ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + expectingUniqueCompiledClasses(new String[] { "p1.NullTest" }); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=411771 + //[compiler][null] Enum constants not recognized as being NonNull. + //Distinguish between enum constant and enum type. The enum type should not + //be marked as NonNull. + public void test411771b() throws JavaModelException { + setupProjectForNullAnnotations(); + String testEnumCode = "package p1;\n" + + "enum TestEnum { FOO };\n"; + env.addClass( this.srcRoot, "p1", "TestEnum", testEnumCode ); + fullBuild( this.projectPath ); + expectingNoProblems(); + + String testClass = "package p1;\n" + + "public class X { TestEnum f; };\n"; + env.addClass( this.srcRoot, "p1", "X", testClass ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + String nullTestCode = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class NullTest {\n" + + " public static TestEnum bla(X x) {\n" + + " @NonNull final TestEnum t = x.f;\n" + + " return t;\n" + + " }\n" + + "}\n"; + IPath test1Path = env.addClass( this.srcRoot, "p1", "NullTest", nullTestCode ); + incrementalBuild( this.projectPath ); + + expectingProblemsFor(test1Path, + "Problem : Null type safety: The expression of type 'TestEnum' needs unchecked conversion to conform to " + + "'@NonNull TestEnum' [ resource : range : <144,147> category : <90> severity : <1>]"); + + expectingUniqueCompiledClasses(new String[] { "p1.NullTest" }); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=411771 + //[compiler][null] Enum constants not recognized as being NonNull. + //A enum may contain fields other than predefined constants. We + //should not tag them as NonNull. + public void test411771c() throws JavaModelException { + setupProjectForNullAnnotations(); + String testClass = "package p1;\n" + + "public class A {}"; + env.addClass( this.srcRoot, "p1", "A", testClass ); + fullBuild( this.projectPath ); + expectingNoProblems(); + + String testEnumCode = "package p1;\n" + + "enum TestEnum {\n" + + " FOO;\n" + + " public static A a;" + + "};\n"; + env.addClass( this.srcRoot, "p1", "TestEnum", testEnumCode ); + incrementalBuild( this.projectPath ); + expectingNoProblems(); + + String nullTestCode = "package p1;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class NullTest {\n" + + " public static TestEnum bla() {\n" + + " @NonNull final TestEnum t = TestEnum.FOO;\n" + + " return t;\n" + + " }\n" + + " public A testint() {\n" + + " @NonNull A a = TestEnum.a;\n" + + " return a;\n" + + " }\n" + + "}"; + IPath test1Path = env.addClass( this.srcRoot, "p1", "NullTest", nullTestCode ); + incrementalBuild( this.projectPath ); + expectingProblemsFor(test1Path, + "Problem : Null type safety: The expression of type 'A' needs unchecked conversion to conform to " + + "'@NonNull A' [ resource : range : <208,218> category : <90> severity : <1>]"); + + expectingUniqueCompiledClasses(new String[] { "p1.NullTest" }); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java new file mode 100644 index 0000000000..6c170df892 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java @@ -0,0 +1,690 @@ +/******************************************************************************* + * Copyright (c) 2000, 2016 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 + * Stephan Herrmann - Contribution for + * Bug 392727 - Cannot compile project when a java file contains $ in its file name + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.util.Hashtable; + +import junit.framework.*; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.core.JavaModelManager; + +/** + * Basic tests of the image builder. + */ +@SuppressWarnings({"rawtypes", "unchecked"}) +public class BasicBuildTests extends BuilderTests { + public BasicBuildTests(String name) { + super(name); + } + static { +// TESTS_NAMES = new String[] { "testBug392727" }; + } + { + System.setProperty(JavaModelManager.MAX_COMPILED_UNITS_AT_ONCE, "0"); + } + public static Test suite() { + return buildTestSuite(BasicBuildTests.class); + } + + public void testBuild() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23894 + */ + public void testToDoMarker() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "todo"); //$NON-NLS-1$ + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL"); //$NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "//todo nothing\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingOnlySpecificProblemFor(pathToA, new Problem("A", "todo nothing", pathToA, 14, 26, -1, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + JavaCore.setOptions(options); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=91426 + */ + public void testToDoMarker2() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX"); //$NON-NLS-1$ + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,LOW"); //$NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "//TODO normal\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public void foo() {\n"+ //$NON-NLS-1$ + " //FIXME high\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + " public void foo2() {\n"+ //$NON-NLS-1$ + " //XXX low\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + fullBuild(projectPath); + IMarker[] markers = env.getTaskMarkersFor(pathToA); + assertEquals("Wrong size", 3, markers.length); + try { + IMarker marker = markers[0]; + Object priority = marker.getAttribute(IMarker.PRIORITY); + String message = (String) marker.getAttribute(IMarker.MESSAGE); + assertTrue("Wrong message", message.startsWith("TODO ")); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority); + + marker = markers[1]; + priority = marker.getAttribute(IMarker.PRIORITY); + message = (String) marker.getAttribute(IMarker.MESSAGE); + assertTrue("Wrong message", message.startsWith("FIXME ")); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_HIGH), priority); + + marker = markers[2]; + priority = marker.getAttribute(IMarker.PRIORITY); + message = (String) marker.getAttribute(IMarker.MESSAGE); + assertTrue("Wrong message", message.startsWith("XXX ")); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_LOW), priority); + } catch (CoreException e) { + assertTrue(false); + } + JavaCore.setOptions(options); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=110797 + */ + public void testTags() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX"); //$NON-NLS-1$ + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,LOW"); //$NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "// TODO FIXME need to review the loop TODO should be done\n" + //$NON-NLS-1$ + "public class A {\n" + //$NON-NLS-1$ + "}"); + + fullBuild(projectPath); + IMarker[] markers = env.getTaskMarkersFor(pathToA); + assertEquals("Wrong size", 3, markers.length); + try { + IMarker marker = markers[2]; + Object priority = marker.getAttribute(IMarker.PRIORITY); + String message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "TODO should be done", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority); + + marker = markers[1]; + priority = marker.getAttribute(IMarker.PRIORITY); + message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "FIXME need to review the loop", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_HIGH), priority); + + marker = markers[0]; + priority = marker.getAttribute(IMarker.PRIORITY); + message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "TODO need to review the loop", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority); + } catch (CoreException e) { + assertTrue(false); + } + JavaCore.setOptions(options); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=110797 + */ + public void testTags2() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX"); //$NON-NLS-1$ + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,LOW"); //$NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "// TODO TODO need to review the loop\n" + //$NON-NLS-1$ + "public class A {\n" + //$NON-NLS-1$ + "}"); + + fullBuild(projectPath); + IMarker[] markers = env.getTaskMarkersFor(pathToA); + assertEquals("Wrong size", 2, markers.length); + try { + IMarker marker = markers[1]; + Object priority = marker.getAttribute(IMarker.PRIORITY); + String message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "TODO need to review the loop", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority); + + marker = markers[0]; + priority = marker.getAttribute(IMarker.PRIORITY); + message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "TODO need to review the loop", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_NORMAL), priority); + } catch (CoreException e) { + assertTrue(false); + } + JavaCore.setOptions(options); + } + + /* + * Ensures that a task tag is not user editable + * (regression test for bug 123721 two types of 'remove' for TODO task tags) + */ + public void testTags3() throws CoreException { + Hashtable options = JavaCore.getOptions(); + + try { + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "TODO,FIXME,XXX"); //$NON-NLS-1$ + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL,HIGH,LOW"); //$NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "// TODO need to review\n" + //$NON-NLS-1$ + "public class A {\n" + //$NON-NLS-1$ + "}"); + + fullBuild(projectPath); + IMarker[] markers = env.getTaskMarkersFor(pathToA); + assertEquals("Marker should not be editable", Boolean.FALSE, markers[0].getAttribute(IMarker.USER_EDITABLE)); + } finally { + JavaCore.setOptions(options); + } + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=92821 + */ + public void testUnusedImport() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "util", "MyException", //$NON-NLS-1$ //$NON-NLS-2$ + "package util;\n" + + "public class MyException extends Exception {\n" + + " private static final long serialVersionUID = 1L;\n" + + "}" + ); + + env.addClass(root, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + + "import util.MyException;\n" + + "public class Test {\n" + + " /**\n" + + " * @throws MyException\n" + + " */\n" + + " public void bar() {\n" + + " }\n" + + "}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + JavaCore.setOptions(options); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=98667 + */ + public void test98667() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Aaa$Bbb$Ccc", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "\n" + //$NON-NLS-1$ + "public class Aaa$Bbb$Ccc {\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + } + + /** + * @bug 164707: ArrayIndexOutOfBoundsException in JavaModelManager if source level == 6.0 + * @test Ensure that AIIOB does not longer happen with invalid source level string + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=164707" + */ + public void testBug164707() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + IJavaProject javaProject = env.getJavaProject(projectPath); + javaProject.setOption(JavaCore.COMPILER_SOURCE, "invalid"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + expectingNoProblems(); + } + + /** + * @bug 75471: [prefs] no re-compile when loading settings + * @test Ensure that changing project preferences is well taking into account while rebuilding project + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=75471" + */ + public void _testUpdateProjectPreferences() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "util", "MyException", //$NON-NLS-1$ //$NON-NLS-2$ + "package util;\n" + + "public class MyException extends Exception {\n" + + " private static final long serialVersionUID = 1L;\n" + + "}" + ); + + IPath cuPath = env.addClass(root, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + + "import util.MyException;\n" + + "public class Test {\n" + + "}" + ); + + fullBuild(projectPath); + expectingSpecificProblemFor( + projectPath, + new Problem("", "The import util.MyException is never used", cuPath, 18, 34, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + + IJavaProject project = env.getJavaProject(projectPath); + project.setOption(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.IGNORE); + incrementalBuild(projectPath); + expectingNoProblems(); + } + public void _testUpdateWkspPreferences() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "util", "MyException", //$NON-NLS-1$ //$NON-NLS-2$ + "package util;\n" + + "public class MyException extends Exception {\n" + + " private static final long serialVersionUID = 1L;\n" + + "}" + ); + + IPath cuPath = env.addClass(root, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + + "import util.MyException;\n" + + "public class Test {\n" + + "}" + ); + + fullBuild(); + expectingSpecificProblemFor( + projectPath, + new Problem("", "The import util.MyException is never used", cuPath, 18, 34, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + + // Save preference + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + IEclipsePreferences preferences = manager.getInstancePreferences(); + String unusedImport = preferences.get(JavaCore.COMPILER_PB_UNUSED_IMPORT, null); + try { + // Modify preference + preferences.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, JavaCore.IGNORE); + incrementalBuild(); + expectingNoProblems(); + } + finally { + if (unusedImport == null) { + preferences.remove(JavaCore.COMPILER_PB_UNUSED_IMPORT); + } else { + preferences.put(JavaCore.COMPILER_PB_UNUSED_IMPORT, unusedImport); + } + } + } + + public void testTags4() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "TODO!,TODO,TODO?"); //$NON-NLS-1$ + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "HIGH,NORMAL,LOW"); //$NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "// TODO! TODO? need to review the loop\n" + //$NON-NLS-1$ + "public class A {\n" + //$NON-NLS-1$ + "}"); + + fullBuild(projectPath); + IMarker[] markers = env.getTaskMarkersFor(pathToA); + assertEquals("Wrong size", 2, markers.length); + + try { + IMarker marker = markers[1]; + Object priority = marker.getAttribute(IMarker.PRIORITY); + String message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "TODO? need to review the loop", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_LOW), priority); + + marker = markers[0]; + priority = marker.getAttribute(IMarker.PRIORITY); + message = (String) marker.getAttribute(IMarker.MESSAGE); + assertEquals("Wrong message", "TODO! need to review the loop", message); + assertNotNull("No task priority", priority); + assertEquals("Wrong priority", Integer.valueOf(IMarker.PRIORITY_HIGH), priority); + } catch (CoreException e) { + assertTrue(false); + } + JavaCore.setOptions(options); + } + + // Bug 392727 - Cannot compile project when a java file contains $ in its file name + public void testBug392727() throws JavaModelException { + int save = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + // this class is the primary unit during build (see comment below) + env.addClass(root, "pack", + "Zork", + "package pack;\npublic class Zork { Main main; }\n" // pull in Main first + ); + + env.addClass(root, "pack", "Main", + "package pack;\n" + + "public class Main {\n" + + " Main$Sub sub;\n" + // indirectly pull in Main$Sub + "}\n" + ); + + env.addClass(root, "pack", "Main$Sub", + "package pack;\n" + + "public class Main$Sub { }\n" + ); + + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; + + // Assumption regarding the order of compilation units: + // - org.eclipse.core.internal.dtree.AbstractDataTreeNode.assembleWith(AbstractDataTreeNode[], AbstractDataTreeNode[], boolean) + // assembles children array in lexical order, so "Zork.java" is last + // - org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(DataTreeNode, IElementContentVisitor) + // iterates children last-to-first so "Zork.java" becomes first in sourceFiles of + // org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.addAllSourceFiles(ArrayList) + // - org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(SourceFile[]) + // puts only "Zork.java" into 'toCompile' (due to MAX_AT_ONCE=1) and the others into 'remainingUnits' + // This ensures that NameEnvironment is setup with "Main.java" and "Main$Sub.java" both served from 'additionalUnits' + // which is essential for reproducing the bug. + + fullBuild(projectPath); + expectingNoProblems(); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = save; + } + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=386901 + public void testbBug386901() throws JavaModelException { + + int previous = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p", "AB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AB {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + IPath pathToAA = env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA extends AZ {}"); //$NON-NLS-1$ + + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; // units compiled in batches of '1' unit + fullBuild(projectPath); + expectingProblemsFor( + pathToAA, + "Problem : AZ cannot be resolved to a type [ resource : range : <36,38> category : <40> severity : <2>]" + ); + + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 0; // All units compiled at once + fullBuild(projectPath); + expectingNoProblems(); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; + } + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=425420 + public void testBug425420() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + // don't env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath path = env.addClass(root, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "class X {\n" + + " void test() {\n" + + " int x = 0;\n" + + " int y = 0 >= 0 ? x : \"\"; \n" + + " }\n" + + "}"); + + fullBuild(projectPath); + expectingProblemsFor( + path, + "Problem : The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files [ resource : range : <0,1> category : <10> severity : <2>]" + ); + } + public void testBug549942() throws JavaModelException { + int save = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "test", + "ARequiresNested", + "package test;\n" + + "\n" + + "public class ARequiresNested {\n" + + " Nested n;\n" + + "}" + ); + + env.addClass(root, "test", + "BRequiresToplevel", + "package test;\n" + + "\n" + + "public class BRequiresToplevel {\n" + + " TopLevel t;\n" + + "}" + ); + + env.addClass(root, "test", + "TopLevel", + "package test;\n" + + "\n" + + "public class TopLevel {\n" + + "\n" + + "}\n" + + "\n" + + "class Nested extends TopLevel {\n" + + "}" + ); + + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 2; + + fullBuild(projectPath); + expectingNoProblems(); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = save; + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug530366Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug530366Test.java new file mode 100644 index 0000000000..32eb03ae7c --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug530366Test.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2018 Simeon Andreev 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: + * Simeon Andreev - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import static org.junit.Assert.assertArrayEquals; + +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; +import org.junit.internal.ArrayComparisonFailure; + +import junit.framework.Test; + +public class Bug530366Test extends BuilderTests { + + private IPath project; + private IPath src; + private IPath somePackage; + + public Bug530366Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug530366Test.class); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + this.project = env.addProject("TestProjectBug530366"); + env.addExternalJars(this.project, Util.getJavaClassLibs()); + + env.removePackageFragmentRoot(this.project, ""); + this.src = env.addPackageFragmentRoot(this.project, "src"); + this.somePackage = env.addPackage(this.src, "somepackage"); + } + + @Override + protected void tearDown() throws Exception { + env.removeProject(this.project); + + super.tearDown(); + } + + /** + * Test for Bug 530366: Changing class name in source leads to missing inner class compilation artifact + * + * Given classes: + * + *
    + *
  • MyClass1, MyClass1$InnerClass, both defined in MyClass1.java
  • + *
  • MyClass2, MyClass2$InnerClass, both defined in MyClass2.java
  • + *
+ * + * Changing the name of the class in MyClass2.java inside a Java editor, from MyClass2 to MyClass1, + * results in overwriting the compiled .class file for MyClass1$InnerClass. + * + * Changing the name of the class in MyClass2.java inside a Java editor, from MyClass1 back to MyClass2, + * results in a missing .class file for MyClass1$InnerClass. + */ + public void testBug530366() throws Exception { + defineNestingClass("MyClass1"); + fullBuild(); + expectingNoProblems(); + + IProject testProject = ResourcesPlugin.getWorkspace().getRoot().getProject("TestProjectBug530366"); + IFile myClass1InnerClass = testProject.getFile("bin/somepackage/MyClass1$InnerClass.class"); + + URI compilationArtifactUri = myClass1InnerClass.getLocationURI(); + byte[] expectedContents = Files.readAllBytes(Paths.get(compilationArtifactUri)); + + String sourceName = "MyClass2"; + String className = "MyClass1"; // deliberately mismatched source and class names + IPath myClass2 = defineNestingClass(sourceName, className); + + incrementalBuild(); + expectProblems(myClass2); + + byte[] actualContents = Files.readAllBytes(Paths.get(compilationArtifactUri)); + + assertEqualContents(expectedContents, actualContents); + + redefineNestingClass("MyClass2"); + incrementalBuild(); + expectingNoProblems(); + + assertTrue("Java builder removed compilation artifact, but should not have", + myClass1InnerClass.exists()); + } + + private IPath redefineNestingClass(String className) { + env.removeClass(this.somePackage, className); + return defineNestingClass(className); + } + + private IPath defineNestingClass(String className) { + return defineNestingClass(className, className); + } + + private IPath defineNestingClass(String sourceName, String className) { + String classContents = String.join("\n" + , "package somepackage;" + , "" + , "public class " + className + " {" + , "" + , " public static class InnerClass {}" + , "}" + ); + IPath source = env.addClass(this.src, "somepackage", sourceName, classContents); + return source; + } + + private void expectProblems(IPath myClass2) { + Problem mismatchedSource = new Problem("", "The public type MyClass1 must be defined in its own file", myClass2, 35, 43, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR); + Problem alreadyDefined = new Problem("", "The type MyClass1 is already defined", myClass2, 35, 43, -1, IMarker.SEVERITY_ERROR); + Problem[] expectedProblems = { mismatchedSource, alreadyDefined }; + expectingOnlySpecificProblemsFor(myClass2, expectedProblems); + } + + private void assertEqualContents(byte[] expectedContents, byte[] actualContents) throws ArrayComparisonFailure { + String failMessage = + String.join(System.lineSeparator() + , "Java builder overwrote existing class file, but should not have" + , "expected class file contents: " + , new String(expectedContents) + , "actual class file contents: " + , new String(actualContents) + ); + assertArrayEquals(failMessage, expectedContents, actualContents); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug531382Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug531382Test.java new file mode 100644 index 0000000000..099bbc018f --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug531382Test.java @@ -0,0 +1,129 @@ +/******************************************************************************* + * Copyright (c) 2018 Simeon Andreev 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: + * Simeon Andreev - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.ByteArrayInputStream; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jdt.core.compiler.BuildContext; +import org.eclipse.jdt.core.tests.builder.ParticipantBuildTests.BuildTestParticipant; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.core.builder.AbstractImageBuilder; + +import junit.framework.Test; + +public class Bug531382Test extends BuilderTests { + + private IPath project; + private IPath src; + private IPath srcPackage; + + private int previousLimit; + + public Bug531382Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug531382Test.class); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + this.project = env.addProject("TestProjectBug531382"); + env.addExternalJars(this.project, Util.getJavaClassLibs()); + + env.removePackageFragmentRoot(this.project, ""); + this.src = env.addPackageFragmentRoot(this.project, "src"); + this.srcPackage = env.addPackage(this.src, "p"); + + /* + * We can work with the limit "as is", however that would mean creating a lot of classes. + * To improve test time we set the limit to a small number and then restore it once the test is done. + * + * This improvement can be removed if the field is to be hidden or made final. + */ + this.previousLimit = AbstractImageBuilder.MAX_AT_ONCE; + AbstractImageBuilder.MAX_AT_ONCE = 42; + } + + @Override + protected void tearDown() throws Exception { + TestBuilderParticipant.PARTICIPANT = null; + + AbstractImageBuilder.MAX_AT_ONCE = this.previousLimit; + + env.removeProject(this.project); + + super.tearDown(); + } + + /** + * Test for Bug 531382. + * + * We create {@link AbstractImageBuilder#MAX_AT_ONCE} sources (e.g. 2000 sources). + * + * A build participant generates one more source during the build. + * + * We expect that this generated source is also compiled after the build. + * To check this we generate the source with an error for it, and we check for the error. + */ + public void testBug531382() throws Exception { + IFolder srcPackageFolder = env.getWorkspace().getRoot().getFolder(this.srcPackage); + assertTrue("package in source must exist", srcPackageFolder.exists()); + + for (int i = 0; i < AbstractImageBuilder.MAX_AT_ONCE; ++i) { + env.addClass(this.src, "p", "X" + i, "package p;\n public class X" + i + " {}"); + } + + final IFile generatedFile = srcPackageFolder.getFile("Generated.java"); + final String contents = "package p;\n public class NameMismatch {}"; + + class GenerateBrokenSource extends BuildTestParticipant { + public void buildStarting(BuildContext[] files, boolean isBatch) { + if (files.length > 0 && !generatedFile.exists()) { + BuildContext context = files[0]; + createFile(generatedFile, contents); + IFile[] generatedFiles = { generatedFile }; + context.recordAddedGeneratedFiles(generatedFiles); + } + } + } + // Creating this sets the build participant singleton. + new GenerateBrokenSource(); + + assertFalse("source to be generated from build participant should not exist before build", generatedFile.exists()); + fullBuild(this.project); + assertTrue("expected source to be generated from build participant", generatedFile.exists()); + + expectCompileProblem(this.project, "The public type NameMismatch must be defined in its own file"); + } + + protected void createFile(IFile generatedFile, String contents) { + boolean force = true; + IProgressMonitor monitor = new NullProgressMonitor(); + try { + generatedFile.create(new ByteArrayInputStream(contents.getBytes()), force, monitor); + generatedFile.setDerived(true, monitor); + } catch (CoreException e) { + throw new AssertionError("failed to generate file in build participant", e); + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug544921Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug544921Test.java new file mode 100644 index 0000000000..5ffa764741 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug544921Test.java @@ -0,0 +1,415 @@ +/******************************************************************************* + * Copyright (c) 2019 Sebastian Zarnekow 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: + * Sebastian Zarnekow - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +import junit.framework.Test; + +public class Bug544921Test extends BuilderTests { + public Bug544921Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug544921Test.class); + } + + public void testCompilerRegression() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.addClass(projectPath, "a", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "import java.util.EnumMap;\n" + + "enum E {}\n" + + "public class Test {\n" + + " Object x = new EnumMap(E.class) {\n" + + " static final long serialVersionUID = 1;\n" + + " {\n" + + " E.values();\n" + + " }\n" + + " };\n" + + "}" //$NON-NLS-1$ + ); + fullBuild(); + expectingNoProblems(); + } + + public void testBuildLargeFile_01() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 1, 10, 64); + fullBuild(); + expectingNoProblems(); + } + + public void testBuildLargeFile_02() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 2, 500, 64); + fullBuild(); + expectingNoProblems(); + } + + public void testBuildLargeFile_03() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 3, 500, 64); + fullBuild(); + expectingNoProblems(); + } + + private boolean hasEnoughMemory(long required) { + long bytes = Runtime.getRuntime().maxMemory(); + long megabytes = bytes / 1024 / 1024; + return megabytes > required; + } + + public void testBuildLargeFile_04() throws JavaModelException, Exception { + if (hasEnoughMemory(2048)) { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 4, 500, 64); + fullBuild(); + expectingNoProblems(); + } + } + + public void testBuildLargeFile_05() throws JavaModelException, Exception { + if (hasEnoughMemory(2048)) { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 5, 500, 64); + fullBuild(); + expectingNoProblems(); + } + } + + public void testBuildLargeFile_08() throws JavaModelException, Exception { + if (hasEnoughMemory(2048)) { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 8, 500, 64); + fullBuild(); + expectingNoProblems(); + } + } + + public void testBuildLargeFile_10() throws JavaModelException, Exception { + if (hasEnoughMemory(2048)) { + IPath projectPath = env.addProject("Bug544921Test", "1.8"); //$NON-NLS-1$ + scaffoldProject(projectPath, 10, 500, 64); + fullBuild(); + expectingNoProblems(); + } + } + + private void scaffoldProject(IPath projectPath, int maxPeripheral, int maxRegister, int maxFields) throws JavaModelException { + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "reg", "Field", //$NON-NLS-1$ //$NON-NLS-2$ + "package reg;\n" + + "\n" + + "import reg.Register.AccessType;\n" + + "\n" + + "public class Field {\n" + + " String name;\n" + + " String description;\n" + + " long bitRange;\n" + + " AccessType accessType;\n" + + "\n" + + " public Field(String name, String description, long bitRange, AccessType accessType) {\n" + + " super();\n" + + " this.name = name;\n" + + " this.description = description;\n" + + " this.bitRange = bitRange;\n" + + " this.accessType = accessType;\n" + + " }\n" + + "\n" + + " @Override\n" + + " public String toString() {\n" + + " return \"Field [name=\" + name + \", description=\" + description + \", bitRange=\" + bitRange + \", accessType=\"\n" + + " + accessType + \"]\";\n" + + " }\n" + + " \n" + + "}" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "reg", "Peripheral", //$NON-NLS-1$ //$NON-NLS-2$ + "package reg;\n" + + "\n" + + "import java.util.Collection;\n" + + "import java.util.Map;\n" + + "import java.util.TreeMap;\n" + + "\n" + + "public class Peripheral {\n" + + "\n" + + " String name;\n" + + " String version;\n" + + " String description;\n" + + " String groupName;\n" + + " long baseAddress;\n" + + " long size;\n" + + "\n" + + " Map registersMap;\n" + + "\n" + + " public Peripheral(String name, String version, String description, String groupName,\n" + + " long baseAddress, long size) {\n" + + " super();\n" + + " this.name = name;\n" + + " this.version = version;\n" + + " this.description = description;\n" + + " this.groupName = groupName;\n" + + " this.baseAddress = baseAddress;\n" + + " this.size = size;\n" + + " }\n" + + "\n" + + " private void initRegistersMap(){\n" + + " if (registersMap != null) {\n" + + " return;\n" + + " }\n" + + " registersMap = new TreeMap<>();\n" + + " for (java.lang.reflect.Field field : this.getClass().getDeclaredFields()) {\n" + + " if (!Register.class.isAssignableFrom(field.getType())){\n" + + " continue;\n" + + " }\n" + + " try {\n" + + " registersMap.put(field.getName(), (Register) field.get(this));\n" + + " } catch (Exception e) {\n" + + " e.printStackTrace();\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " public Register getRegister(String name) {\n" + + " return registersMap.get(name);\n" + + " }\n" + + " public Collection getRegisters(){\n" + + " initRegistersMap();\n" + + " return registersMap.values();\n" + + " }\n" + + "}\n" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "reg", "Reg", //$NON-NLS-1$ //$NON-NLS-2$ + "package reg;\n" + + "\n" + + "public final class Reg {\n" + + "\n" + + " Peripheral_TIMER0 peripheral_Timer0 = new Peripheral_TIMER0();\n" + + "\n" + + " public static final class Peripheral_TIMER0 extends Peripheral {\n" + + "\n" + + " public Peripheral_TIMER0() {\n" + + " super(\"TIMER0\", \"1.0\", \"desc\", \"groupName\", 0, 32);\n" + + " }\n" + + "\n" + + " public Reg_CR regCR = new Reg_CR();\n" + + "\n" + + " public static final class Reg_CR extends Register {\n" + + " public Reg_CR() {\n" + + " super(\"CR\", \"\", 0, 32, AccessType.readWrite, 0xf, 0x0);\n" + + " }\n" + + "\n" + + " // fields of CR\n" + + " public Field_EN fieldEn = new Field_EN();\n" + + "\n" + + " public static final class Field_EN extends Field {\n" + + " public Field_EN() {\n" + + " super(\"EN\", \"description\", 0, AccessType.readWrite);\n" + + " }\n" + + " }\n" + + "\n" + + " public Field_RST fieldRST = new Field_RST();\n" + + "\n" + + " public static final class Field_RST extends Field {\n" + + " public Field_RST() {\n" + + " super(\"RST\", \"description\", 1, AccessType.readWrite);\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " public static void main(String[] args) {\n" + + " Reg reg = new Reg();\n" + + "\n" + + " System.out.println(reg.peripheral_Timer0.regCR.name + \": \" + reg.peripheral_Timer0.regCR.resetValue);\n" + + " System.out.println(reg.peripheral_Timer0.regCR.fieldEn.name + \": \" + reg.peripheral_Timer0.regCR.fieldEn.bitRange);\n" + + " }\n" + + "}\n" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "reg", "Register", //$NON-NLS-1$ //$NON-NLS-2$ + "package reg;\n" + + "\n" + + "import java.util.Collection;\n" + + "import java.util.Map;\n" + + "import java.util.TreeMap;\n" + + "\n" + + "public class Register {\n" + + "\n" + + " public enum AccessType {\n" + + " readOnly, readWrite;\n" + + " }\n" + + "\n" + + " String name;\n" + + " String description;\n" + + " long addressOffset;\n" + + " long size;\n" + + " AccessType accessType;\n" + + " long resetValue;\n" + + " long resetMask;\n" + + " long value;\n" + + "\n" + + " Map fieldsMap;\n" + + "\n" + + " public Register(String name, String description, long addressOffset, long size,\n" + + " AccessType accessType, long resetValue, long resetMask) {\n" + + " this.name = name;\n" + + " this.description = description;\n" + + " this.addressOffset = addressOffset;\n" + + " this.size = size;\n" + + " this.accessType = accessType;\n" + + " this.resetValue = resetValue;\n" + + " this.resetMask = resetMask;\n" + + "\n" + + " }\n" + + "\n" + + " private void initFieldsMap(){\n" + + " if (fieldsMap != null) {\n" + + " return;\n" + + " }\n" + + " fieldsMap = new TreeMap<>();\n" + + " for (java.lang.reflect.Field field : this.getClass().getDeclaredFields()) {\n" + + " if (!Field.class.isAssignableFrom(field.getType())){\n" + + " continue;\n" + + " }\n" + + " try {\n" + + " fieldsMap.put(field.getName(), (Field) field.get(this));\n" + + " } catch (Exception e) {\n" + + " e.printStackTrace();\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " public void setValue(long value){\n" + + " this.value = value;\n" + + " }\n" + + "\n" + + " public long getValue(){\n" + + " return this.value;\n" + + " }\n" + + "\n" + + " public Collection getFields(){\n" + + " initFieldsMap();\n" + + " return fieldsMap.values();\n" + + " }\n" + + "\n" + + " @Override\n" + + " public String toString() {\n" + + " return \"Register [name=\" + name + \", description=\" + description + \", addressOffset=\" + addressOffset\n" + + " + \", size=\" + size + \", accessType=\" + accessType + \", resetValue=\" + resetValue + \", resetMask=\"\n" + + " + resetMask + \"]\";\n" + + " }\n" + + "\n" + + "\n" + + "}\n" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "reg.generate", "DeviceXY", genSource(maxPeripheral, maxRegister, maxFields)); + } + + public static String genSource(int maxPeripheral, int maxRegister, int maxFields) { + /* + * + * The example that took 25 minutes was generated with: int maxPeripheral = 10; + * int maxRegister = 500; int maxFields = 64; + * + * Still performs ok (less than a minute): int maxPeripheral = 2; int + * maxRegister = 500; int maxFields = 64; + * + * With this (8 MB) it gets already slow (few minutes): int maxPeripheral = 3; + * int maxRegister = 500; int maxFields = 64; + * + * This takes 5 minutes (14MB file-size): int maxPeripheral = 5; int maxRegister + * = 500; int maxFields = 64; + */ + + StringBuilder source = new StringBuilder(); + + source.append("package reg.generate;").append(System.lineSeparator()); + source.append("public class DeviceXY {").append(System.lineSeparator()); + source.append("private static DeviceXY instance;").append(System.lineSeparator()); + source.append("private DeviceXY() {}").append(System.lineSeparator()); + source.append("public static DeviceXY getInstance() {").append(System.lineSeparator()); + source.append(" if (instance == null) { instance = new DeviceXY(); }").append(System.lineSeparator()); + source.append(" return instance;").append(System.lineSeparator()); + source.append("}").append(System.lineSeparator()); + + for (int peripheral = 0; peripheral < maxPeripheral; peripheral++) { + String peripheralName = "peri_" + peripheral; + String peripheralClassName = String.valueOf(Character.toUpperCase(peripheralName.charAt(0))) + + peripheralName.substring(1); + + source.append("public ").append(peripheralClassName).append(" ").append(peripheralName) + .append(" = new ").append(peripheralClassName).append("();").append(System.lineSeparator()); + source.append("public static final class ").append(peripheralClassName) + .append(" extends reg.Peripheral {").append(System.lineSeparator()); + // constructor start + source.append("public ").append(peripheralClassName).append("() {").append(System.lineSeparator()); + source.append(" super(\"").append(peripheralName).append("\",") + .append("\"1.0\",\"desc\", \"groupName\", 0, 32);").append(System.lineSeparator()); + source.append("}").append(System.lineSeparator()); + // constructor end + + for (int register = 0; register < maxRegister; register++) { + String registerName = "reg_" + register; + String registerClassName = String.valueOf(Character.toUpperCase(registerName.charAt(0))) + + registerName.substring(1); + + source.append("public ").append(registerClassName).append(" ").append(registerName) + .append(" = new ").append(registerClassName).append("();").append(System.lineSeparator()); + + source.append("/**").append(System.lineSeparator()); + source.append("* Register ").append(registerName).append(System.lineSeparator()); + source.append("*/").append(System.lineSeparator()); + source.append("public static final class ").append(registerClassName) + .append(" extends reg.Register {").append(System.lineSeparator()); + // constructor start + source.append("public ").append(registerClassName).append("() {") + .append(System.lineSeparator()); + source.append(" super(\"").append(registerName).append("\",") + .append("\"desc\", 0, 32, AccessType.readWrite, 0xf, 0x0);").append(System.lineSeparator()); + source.append("}").append(System.lineSeparator()); + // constructor end + + source.append("//fields").append(System.lineSeparator()); + + for (int field = 0; field < maxFields; field++) { + String fieldName = "field_" + field; + source.append("public ").append("reg.Field").append(" ").append(fieldName) + .append(" = new ").append("reg.Field").append("(\"").append(fieldName).append("\",") + .append("\"desc\", 0, AccessType.readWrite);").append(System.lineSeparator()); + + } + + source.append("}").append(System.lineSeparator()); + } + source.append("}").append(System.lineSeparator()); + } + + + source.append("}").append(System.lineSeparator()); + + return source.toString(); + + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549457Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549457Test.java new file mode 100644 index 0000000000..8b4d881e9a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549457Test.java @@ -0,0 +1,116 @@ +/******************************************************************************* + * Copyright (c) 2019 Simeon Andreev 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: + * Simeon Andreev - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.ByteArrayInputStream; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.core.JavaProject; + +import junit.framework.Test; + +public class Bug549457Test extends BuilderTests { + + private IPath project; + private IPath src; + private IPath srcPackage; + private boolean oldAutoBuilding; + + public Bug549457Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug549457Test.class); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + this.project = env.addProject("Bug549457Test"); + env.addExternalJars(this.project, Util.getJavaClassLibs()); + + env.removePackageFragmentRoot(this.project, ""); + this.src = env.addPackageFragmentRoot(this.project, "src"); + this.srcPackage = env.addPackage(this.src, "p"); + + this.oldAutoBuilding = env.isAutoBuilding(); + env.setAutoBuilding(true); + waitForAutoBuild(); + } + + @Override + protected void tearDown() throws Exception { + TestBuilderParticipant.PARTICIPANT = null; + env.removeProject(this.project); + env.setAutoBuilding(this.oldAutoBuilding); + waitForAutoBuild(); + super.tearDown(); + } + + /** + * Test for Bug 549457. + * + * We expect that a JDT compiler setting change triggers a build, resulting in a build problem. + */ + public void testBug549457() throws Exception { + IFolder srcPackageFolder = env.getWorkspace().getRoot().getFolder(this.srcPackage); + assertTrue("package in source must exist", srcPackageFolder.exists()); + + env.addClass(this.src, "p", "X", "package p;\n public interface X { default void foo() { /* cause an error with Java 7 */ } }"); + + fullBuild(this.project); + // For this test, the default is not Java 8. If this changes, we can expect no problems here. The test cares only that the source was compiled. + expectCompileProblem(this.project, "Default methods are allowed only at source level 1.8 or above"); + + IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); + IProject testProject = workspaceRoot.getProject("Bug549457Test"); + IJavaProject javaProject = JavaCore.create(testProject); + javaProject.setOption(CompilerOptions.OPTION_Compliance, "1.8"); + javaProject.setOption(CompilerOptions.OPTION_Source, "1.8"); + testProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + waitForAutoBuild(); + fullBuild(this.project); + expectNoCompileProblems(this.project); + + String jdtCorePreferencesFile = JavaProject.DEFAULT_PREFERENCES_DIRNAME + IPath.SEPARATOR + JavaProject.JAVA_CORE_PREFS_FILE; + IFile settingsFile = testProject.getFile(jdtCorePreferencesFile); + assertTrue("expected \"" + jdtCorePreferencesFile + "\" to exist after setting compiler compliance to Java 1.7", settingsFile.exists()); + + String newContents = String.join( + CompilerOptions.OPTION_Compliance + "=1.7", + CompilerOptions.OPTION_Source + "=1.7"); + + settingsFile.setContents(new ByteArrayInputStream(newContents.getBytes()), IResource.FORCE, new NullProgressMonitor()); + waitForAutoBuild(); + expectCompileProblem(this.project, "Default methods are allowed only at source level 1.8 or above"); + } + + private void waitForAutoBuild() throws InterruptedException { + Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, new NullProgressMonitor()); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549646Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549646Test.java new file mode 100644 index 0000000000..f661339d08 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug549646Test.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * Copyright (c) 2019 Sebastian Zarnekow 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: + * Sebastian Zarnekow - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; + +import junit.framework.Test; + +public class Bug549646Test extends BuilderTests { + public Bug549646Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug549646Test.class); + } + + public void testCompilerRegression() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug549646Test", "10"); //$NON-NLS-1$ + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED); + + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.addClass(projectPath, "test", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package test;\n" + + "import java.util.Map;\n" + + "import java.util.Map.Entry;\n" + + "public class A {\n" + + " void a(Map a) {\n" + + " for (Entry iterableElement : a.entrySet()) {\n" + + " iterableElement.toString();\n" + + " }\n" + + " }\n" + + "}\n" //$NON-NLS-1$ + ); + env.addClass(projectPath, "test", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package test;\n" + + "import java.util.HashMap;\n" + + "public class B {\n" + + " void test() {\n" + + " new A().a(new HashMap());\n" + + " }\n" + + "}\n" //$NON-NLS-1$ + ); + fullBuild(); + + boolean isJRE11 = CompilerOptions.VERSION_11.equals(System.getProperty("java.specification.version")); + if (isJRE11 && env.getProblemsFor(projectPath).length > 0) { + // bogus class lookup (ignoring modules) due to insufficient data in ct.sym (non-deterministically triggers the below problems) + // see also https://bugs.eclipse.org/549647 + expectingProblemsFor(projectPath, + "Problem : Entry cannot be resolved to a type [ resource : range : <120,125> category : <40> severity : <2>]\n" + + "Problem : The type java.util.Map.Entry is not visible [ resource : range : <43,62> category : <40> severity : <2>]\n" + + "Problem : Type mismatch: cannot convert from element type Map.Entry to Entry [ resource : range : <160,172> category : <40> severity : <2>]"); + } else { + expectingNoProblems(); + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug561287Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug561287Test.java new file mode 100644 index 0000000000..5a167f18e2 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug561287Test.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2020 Stephan Herrmann 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: + * Stephan Herrmann - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.core.builder.AbstractImageBuilder; + +import junit.framework.Test; + +public class Bug561287Test extends BuilderTests { + public Bug561287Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug561287Test.class); + } + public void testBuilderRegression() throws JavaModelException, Exception { + int maxAtOnce = AbstractImageBuilder.MAX_AT_ONCE; + AbstractImageBuilder.MAX_AT_ONCE = 2; + try { + IPath projectPath = env.addProject("Bug561287Test", "1.8"); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED); + env.removePackageFragmentRoot(projectPath, ""); + IPath src = env.addPackageFragmentRoot(projectPath, "src"); + + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.addClass(src, "bug561287", "A0", + "package bug561287;\n" + + "import bug561287.sub.B0;\n" + + "\n" + + "public class A0 {\n" + + " B0 b;\n" + + "}\n"); + env.addClass(src, "bug561287", "A1", + "package bug561287;\n" + + "\n" + + "public class A1 {\n" + + "\n" + + "}\n"); + env.addClass(src, "bug561287/sub", "B0", + "package bug561287.sub;\n" + + "\n" + + "public class B0 {\n" + + "\n" + + "}\n" + + "\n"); + env.addFolder(src, "bug561287/sub/directory"); + env.addFile(src, "bug561287/sub/directory/test.txt", ""); + fullBuild(); + + expectingNoProblems(); + } finally { + AbstractImageBuilder.MAX_AT_ONCE = maxAtOnce; + } + } +} \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug562420Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug562420Test.java new file mode 100644 index 0000000000..90f691a6c7 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug562420Test.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2020 Stephan Herrmann 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: + * Stephan Herrmann - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; + +import junit.framework.Test; + +public class Bug562420Test extends BuilderTests { + public Bug562420Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug562420Test.class); + } + public void testBuilderRegression() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug562420Test", "9"); + env.removePackageFragmentRoot(projectPath, ""); + IPath src = env.addPackageFragmentRoot(projectPath, "src"); + + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + IPath testAppPath = env.addClass(src, "org.easylibs.test", "TestApp", + "package org.easylibs.test;\n" + + "public class TestApp {\n" + + " public static void main(String[] args) {\n" + + " System.out.println(\"Hello World\");\n" + + " }\n" + + "}\n"); + env.addFile(testAppPath.removeLastSegments(1), "package-info.java", + "package org.easylibs.test;"); + env.addFile(src, "module-info.java", + "module test {\n" + + " requires java.base;\n" + + " exports org.easylibs.test;\n" + + "}\n"); + fullBuild(); + if (CompilerOptions.versionToJdkLevel(System.getProperty("java.specification.version")) < ClassFileConstants.JDK9) { + expectingProblemsFor(projectPath, + "Problem : java.base cannot be resolved to a module [ resource : range : <24,33> category : <160> severity : <2>]"); + } else { + expectingNoProblems(); + } + + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_SOURCE, "1.8"); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, "1.8"); + fullBuild(); + expectingProblemsFor(projectPath, + "Problem : Syntax error on token \".\", , expected [ resource : range : <28,29> category : <20> severity : <2>]\n" + + "Problem : Syntax error on token \".\", = expected [ resource : range : <47,48> category : <20> severity : <2>]\n" + + "Problem : Syntax error on token \"module\", interface expected [ resource : range : <0,6> category : <20> severity : <2>]"); + } +} \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug564905Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug564905Test.java new file mode 100644 index 0000000000..86f54d2d5c --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug564905Test.java @@ -0,0 +1,202 @@ +/******************************************************************************* + * Copyright (c) 2020 Simeon Andreev 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: + * Simeon Andreev - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.IOException; +import java.net.URI; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.tests.util.Util; +import junit.framework.Test; + +public class Bug564905Test extends BuilderTests { + + private static final String OUTPUT_FOLDER_NAME = "bin"; + + private String projectName; + private IProject project; + private IPath projectPath; + private IPath src; + private IFolder outputFolder; + private boolean oldAutoBuilding; + + public Bug564905Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug564905Test.class); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + this.projectName = "Bug564905Test"; + this.projectPath = env.addProject(this.projectName); + this.project = env.getWorkspace().getRoot().getProject(this.projectName); + env.addExternalJars(this.projectPath, Util.getJavaClassLibs()); + + env.removePackageFragmentRoot(this.projectPath, ""); + String outputFolderPath = "tmp/" + OUTPUT_FOLDER_NAME; + this.src = env.addPackageFragmentRoot(this.projectPath, "src", null, outputFolderPath); + this.outputFolder = env.getWorkspace().getRoot().getFolder(this.projectPath.append(outputFolderPath)); + + this.oldAutoBuilding = env.isAutoBuilding(); + env.setAutoBuilding(true); + waitForAutoBuild(); + } + + @Override + protected void tearDown() throws Exception { + TestBuilderParticipant.PARTICIPANT = null; + env.removeProject(this.projectPath); + env.setAutoBuilding(this.oldAutoBuilding); + waitForAutoBuild(); + + super.tearDown(); + } + + /** + * Test for Bug 564905, with option {@code org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder} enabled. + * + * When the output folder of a project is removed in file system, on refresh we expect a build. + */ + public void testBug564905_recreateModifiedClassFileInOutputFolder_enabled() throws Exception { + enableOption_recreateModifiedClassFileInOutputFolder(); + assertOutputFolderEmpty(); + + addSourceAndBuild(); + assertOutputFolderNotEmpty(); + + deleteOutputFolderAndWaitForAutoBuild(); + // we enabled "recreateModifiedClassFileInOutputFolder", so we expect compile artifacts + assertOutputFolderNotEmpty(); + } + + /** + * Test for Bug 564905, with option {@code org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder} disabled. + * + * When the output folder of a project is removed in file system, on refresh we don't expect a build + * as we don't use the option {@link JavaCore#CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER}. + */ + public void testBug564905_recreateModifiedClassFileInOutputFolder_disabled() throws Exception { + disableOption_recreateModifiedClassFileInOutputFolder(); + assertOutputFolderEmpty(); + + addSourceAndBuild(); + assertOutputFolderNotEmpty(); + + deleteOutputFolderAndWaitForAutoBuild(); + // we disabled "recreateModifiedClassFileInOutputFolder", so we don't expect compile artifacts + assertOutputFolderEmpty(); + } + + private void deleteOutputFolderAndWaitForAutoBuild() throws Exception { + // close the project, since the bug 564905 occurs when build state is read from disk + this.project.close(new NullProgressMonitor()); + waitForAutoBuild(); + URI outputFolderUri = this.outputFolder.getLocationURI(); + // delete the output folder with file system API, so that Eclipse resources API "doesn't notice" + deleteFolderInFileSystem(outputFolderUri); + + // re-open the project, refresh it, then wait for auto-build; expect that something was built + this.project.open(new NullProgressMonitor()); + this.project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + waitForAutoBuild(); + } + + private void addSourceAndBuild() { + IPath srcPackage = env.addPackage(this.src, "p"); + IFolder srcPackageFolder = env.getWorkspace().getRoot().getFolder(srcPackage); + assertTrue("package in source must exist", srcPackageFolder.exists()); + env.addClass(this.src, "p", "X", "package p;\n public interface X { void foo() { /* we want something compiled, anything works */ } }"); + fullBuild(this.projectPath); + } + + private void enableOption_recreateModifiedClassFileInOutputFolder() throws Exception { + setJavaProjectOption(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER, JavaCore.ENABLED); + } + + private void disableOption_recreateModifiedClassFileInOutputFolder() throws Exception { + setJavaProjectOption(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER, JavaCore.DISABLED); + } + + private void setJavaProjectOption(String optionName, String optionValue) throws Exception { + IJavaProject javaProject = JavaCore.create(this.project); + javaProject.setOption(optionName, optionValue); + this.project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); + waitForAutoBuild(); + } + + private void waitForAutoBuild() throws InterruptedException { + Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, new NullProgressMonitor()); + } + + private static void deleteFolderInFileSystem(URI uri) throws IOException { + Files.walkFileTree(Paths.get(uri), new DeleteVisitor()); + } + + private void assertOutputFolderEmpty() throws CoreException { + assertTrue("output folder must exist", this.outputFolder.exists()); + IResource[] outputFolderContent = this.outputFolder.members(); + assertEquals("output folder must be empty, instead had contents: " + toString(outputFolderContent), 0, outputFolderContent.length); + } + + private void assertOutputFolderNotEmpty() throws CoreException { + assertTrue("output folder must exist", this.outputFolder.exists()); + assertTrue("output folder must not be empty", this.outputFolder.members().length > 0); + } + + private static String toString(IResource[] resources) { + StringBuilder result = new StringBuilder(); + for (IResource resource : resources) { + result.append(resource.getName()); + result.append(System.lineSeparator()); + } + return result.toString(); + } + + static class DeleteVisitor extends SimpleFileVisitor { + @Override + public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { + Files.delete(file); + return FileVisitResult.CONTINUE; + } + + @Override + public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { + if (exc != null) { + throw exc; + } + Files.delete(dir); + return FileVisitResult.CONTINUE; + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug571363Test.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug571363Test.java new file mode 100644 index 0000000000..726fb39c47 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Bug571363Test.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat Inc. 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: + * Red Hat Inc. - initial implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; +import junit.framework.Test; + +public class Bug571363Test extends BuilderTests { + + public Bug571363Test(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Bug571363Test.class); + } + + /** + * Returns the OS path to the directory that contains this plugin. + */ + protected String getCompilerTestsPluginDirectoryPath() { + try { + URL platformURL = Platform.getBundle("org.eclipse.jdt.core.tests.builder").getEntry("/"); + return new File(FileLocator.toFileURL(platformURL).getFile()).getAbsolutePath(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + public void _testBug571363() throws JavaModelException, Exception { + IPath projectPath = env.addProject("Bug571364Test", "12"); //$NON-NLS-1$ + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_11); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_RELEASE, JavaCore.ENABLED); + + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "test", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package test;\n" + + "public class A {\n" + + " org.w3c.dom.Element list;\n" + + "}\n" //$NON-NLS-1$ + ); + StringBuilder buffer = new StringBuilder("\n"); //$NON-NLS-1$ + buffer.append("\n"); //$NON-NLS-1$ + buffer.append(" \n"); //$NON-NLS-1$ + buffer.append(" \n"); + buffer.append(" \n"); + buffer.append(" \n"); + buffer.append(" \n"); + buffer.append(" \n"); + buffer.append(" "); + buffer.append(" \n"); //$NON-NLS-1$ + buffer.append(""); //$NON-NLS-1$ + env.addFile(projectPath, ".classpath", buffer.toString()); //$NON-NLS-1$ + fullBuild(); + + expectingNoProblems(); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java new file mode 100644 index 0000000000..f339f38fb0 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuilderTests.java @@ -0,0 +1,675 @@ +/******************************************************************************* + * Copyright (c) 2000, 2021 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.builder; + +import static org.eclipse.jdt.core.tests.util.AbstractCompilerTest.*; + +import java.io.FileInputStream; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.junit.extension.TestCase; +import org.eclipse.jdt.core.tests.util.TestVerifier; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.compiler.Compiler; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Base class for Java image builder tests + */ +@SuppressWarnings({"rawtypes", "unchecked"}) +public class BuilderTests extends TestCase { + protected static boolean DEBUG = false; + protected static TestingEnvironment env = null; + protected EfficiencyCompilerRequestor debugRequestor = null; + + public BuilderTests(String name) { + super(name); + } + + protected void cleanBuild() { + this.debugRequestor.clearResult(); + this.debugRequestor.activate(); + env.cleanBuild(); + this.debugRequestor.deactivate(); + } + + protected void cleanBuild(String name) { + this.debugRequestor.clearResult(); + this.debugRequestor.activate(); + env.cleanBuild(name); + this.debugRequestor.deactivate(); + } + + /** Execute the given class. Expecting output and error must be specified. + */ + protected void executeClass( + IPath projectPath, + String className, + String expectingOutput, + String expectedError) { + TestVerifier verifier = new TestVerifier(false); + ArrayList classpath = new ArrayList<>(5); + + IPath workspacePath = env.getWorkspaceRootPath(); + + classpath.add(workspacePath.append(env.getOutputLocation(projectPath)).toOSString()); + IClasspathEntry[] cp = env.getClasspath(projectPath); + for (int i = 0; i < cp.length; i++) { + IPath c = cp[i].getPath(); + String ext = c.getFileExtension(); + if (ext != null && (ext.equals("zip") || ext.equals("jar"))) { //$NON-NLS-1$ //$NON-NLS-2$ + if (c.getDevice() == null) { + classpath.add(workspacePath.append(c).toOSString()); + } else { + classpath.add(c.toOSString()); + } + } + } + + verifier.execute(className, classpath.toArray(new String[0])); + + if (DEBUG) { + System.out.println("ERRORS\n"); //$NON-NLS-1$ + System.out.println(Util.displayString(verifier.getExecutionError())); + + System.out.println("OUTPUT\n"); //$NON-NLS-1$ + System.out.println(Util.displayString(verifier.getExecutionOutput())); + } + String actualError = verifier.getExecutionError(); + + // workaround pb on 1.3.1 VM (line delimitor is not the platform line delimitor) + char[] error = actualError.toCharArray(); + actualError = new String(CharOperation.replace(error, System.getProperty("line.separator").toCharArray(), new char[] { '\n' })); //$NON-NLS-1$ + + if (actualError.indexOf(expectedError) == -1) { + System.out.println("ERRORS\n"); //$NON-NLS-1$ + System.out.println(Util.displayString(actualError)); + } + assertTrue("unexpected error : " + actualError + " expected : " + expectedError, actualError.indexOf(expectedError) != -1); //$NON-NLS-1$ //$NON-NLS-2$ + + String actualOutput = verifier.getExecutionOutput(); + if (actualOutput.indexOf(expectingOutput) == -1) { + System.out.println("OUTPUT\n"); //$NON-NLS-1$ + System.out.println(Util.displayString(actualOutput)); + } + assertTrue("unexpected output :" + actualOutput + " expected: " + expectingOutput, actualOutput.indexOf(expectingOutput) != -1); //$NON-NLS-1$ + + } + + protected void expectingParticipantProblems(IPath path, String expected) { + Problem[] problems = env.getProblemsFor(path, "org.eclipse.jdt.core.tests.compile.problem"); + StringBuilder buf = new StringBuilder(); + for (int i = 0, length = problems.length; i < length; i++) { + Problem problem = problems[i]; + buf.append(problem.getMessage()); + if (i < length - 1) buf.append('\n'); + } + assertEquals("Unexpected problems", expected, buf.toString()); + } + + /** Verifies that given element is not present. + */ + protected void expectingPresenceOf(IPath path) { + expectingPresenceOf(new IPath[] { path }); + } + + /** Verifies that given elements are not present. + */ + protected void expectingPresenceOf(IPath[] paths) { + IPath wRoot = env.getWorkspaceRootPath(); + + for (int i = 0; i < paths.length; i++) + assertTrue(paths[i] + " is not present", wRoot.append(paths[i]).toFile().exists()); //$NON-NLS-1$ + } + + /** Verifies that given element is not present. + */ + protected void expectingNoPresenceOf(IPath path) { + expectingNoPresenceOf(new IPath[] { path }); + } + + /** Verifies that given elements are not present. + */ + protected void expectingNoPresenceOf(IPath[] paths) { + IPath wRoot = env.getWorkspaceRootPath(); + + for (int i = 0; i < paths.length; i++) + assertTrue(paths[i] + " is present", !wRoot.append(paths[i]).toFile().exists()); //$NON-NLS-1$ + } + + /** Verifies that given classes have been compiled. + */ + protected void expectingCompiledClasses(String[] expected) { + String[] actual = this.debugRequestor.getCompiledClasses(); + org.eclipse.jdt.internal.core.util.Util.sort(actual); + org.eclipse.jdt.internal.core.util.Util.sort(expected); + expectingCompiling(actual, expected, "unexpected recompiled units"); //$NON-NLS-1$ + } + + /** + * Verifies that the given classes and no others have been compiled, + * but permits the classes to have been compiled more than once. + */ + protected void expectingUniqueCompiledClasses(String[] expected) { + String[] actual = this.debugRequestor.getCompiledClasses(); + org.eclipse.jdt.internal.core.util.Util.sort(actual); + // Eliminate duplicate entries + int dups = 0; + for (int i = 0; i < actual.length - 1; ++i) { + if (actual[i + 1].equals(actual[i])) { + ++dups; + actual[i] = null; + } + } + String[] uniqueActual = new String[actual.length - dups]; + for (int i = 0, j = 0; i < actual.length; ++i) { + if (actual[i] != null) { + uniqueActual[j++] = actual[i]; + } + } + org.eclipse.jdt.internal.core.util.Util.sort(expected); + expectingCompiling(uniqueActual, expected, "unexpected compiled units"); //$NON-NLS-1$ + } + + /** Verifies that given classes have been compiled in the specified order. + */ + protected void expectingCompilingOrder(String[] expected) { + expectingCompiling(this.debugRequestor.getCompiledFiles(), expected, "unexpected compiling order"); //$NON-NLS-1$ + } + + private void expectingCompiling(String[] actual, String[] expected, String message) { + if (DEBUG) + for (int i = 0; i < actual.length; i++) + System.out.println(actual[i]); + + StringBuilder actualBuffer = new StringBuilder("{ "); //$NON-NLS-1$ + for (int i = 0; i < actual.length; i++) { + if (i > 0) + actualBuffer.append(", "); //$NON-NLS-1$ + actualBuffer.append("\""); + actualBuffer.append(actual[i]); + actualBuffer.append("\""); + } + actualBuffer.append(" }"); + StringBuilder expectedBuffer = new StringBuilder("{ "); //$NON-NLS-1$ + for (int i = 0; i < expected.length; i++) { + if (i > 0) + expectedBuffer.append(", "); //$NON-NLS-1$ + expectedBuffer.append("\""); + expectedBuffer.append(expected[i]); + expectedBuffer.append("\""); + } + expectedBuffer.append(" }"); + assertEquals(message, expectedBuffer.toString(), actualBuffer.toString()); + } + + /** Verifies that the workspace has no problems. + */ + protected void expectingNoProblems() { + expectingNoProblemsFor(env.getWorkspaceRootPath()); + } + + /** Verifies that the given element has no problems. + */ + protected void expectingNoProblemsFor(IPath root) { + expectingNoProblemsFor(new IPath[] { root }); + } + + /** Verifies that the given elements have no problems. + */ + protected void expectingNoProblemsFor(IPath[] roots) { + StringBuilder buffer = new StringBuilder(); + Problem[] allProblems = allSortedProblems(roots); + if (allProblems != null) { + for (int i=0, length=allProblems.length; i expected.length) { + for (Enumeration e = actual.elements(); e.hasMoreElements();) { + IPath path = (IPath) e.nextElement(); + boolean found = false; + for (int i = 0; i < expected.length; ++i) { + if (path.equals(expected[i])) { + found = true; + break; + } + } + if (!found) + assertTrue("unexpected problem(s) with " + path.toString(), false); //$NON-NLS-1$ + } + } + } + + /** Verifies that the given element has a specific problem and + * only the given problem. + */ + protected void expectingOnlySpecificProblemFor(IPath root, Problem problem) { + expectingOnlySpecificProblemsFor(root, new Problem[] { problem }); + } + + /** Verifies that the given element has specifics problems and + * only the given problems. + */ + protected void expectingOnlySpecificProblemsFor(IPath root, Problem[] expectedProblems) { + if (DEBUG) + printProblemsFor(root); + + Problem[] rootProblems = env.getProblemsFor(root); + + for (int i = 0; i < expectedProblems.length; i++) { + Problem expectedProblem = expectedProblems[i]; + boolean found = false; + for (int j = 0; j < rootProblems.length; j++) { + if(expectedProblem.equals(rootProblems[j])) { + found = true; + rootProblems[j] = null; + break; + } + } + if (!found) { + printProblemsFor(root); + } + assertTrue("problem not found: " + expectedProblem.toString(), found); //$NON-NLS-1$ + } + for (int i = 0; i < rootProblems.length; i++) { + if(rootProblems[i] != null) { + printProblemsFor(root); + assertTrue("unexpected problem: " + rootProblems[i].toString(), false); //$NON-NLS-1$ + } + } + } + + /** Verifies that the given element has problems. + */ + protected void expectingProblemsFor(IPath root, String expected) { + expectingProblemsFor(new IPath[] { root }, expected); + } + + /** Verifies that the given elements have problems. + */ + protected void expectingProblemsFor(IPath[] roots, String expected) { + Problem[] problems = allSortedProblems(roots); + assumeEquals("Invalid problem(s)!!!", expected, arrayToString(problems)); //$NON-NLS-1$ + } + + /** + * Verifies that the given element has the expected problems. + */ + protected void expectingProblemsFor(IPath root, List expected) { + expectingProblemsFor(new IPath[] { root }, expected); + } + + /** + * Verifies that the given elements have the expected problems. + */ + protected void expectingProblemsFor(IPath[] roots, List expected) { + Problem[] allProblems = allSortedProblems(roots); + assumeEquals("Invalid problem(s)!!!", arrayToString(expected.toArray()), arrayToString(allProblems)); + } + + /** Verifies that the given element has a specific problem. + */ + protected void expectingSpecificProblemFor(IPath root, Problem problem) { + expectingSpecificProblemsFor(root, new Problem[] { problem }); + } + + /** Verifies that the given element has specific problems. + */ + protected void expectingSpecificProblemsFor(IPath root, Problem[] problems) { + if (DEBUG) + printProblemsFor(root); + + Problem[] rootProblems = env.getProblemsFor(root); + next : for (int i = 0; i < problems.length; i++) { + Problem problem = problems[i]; + for (int j = 0; j < rootProblems.length; j++) { + Problem rootProblem = rootProblems[j]; + if (rootProblem != null) { + if (problem.equals(rootProblem)) { + rootProblems[j] = null; + continue next; + } + } + } + /* + for (int j = 0; j < rootProblems.length; j++) { + Problem pb = rootProblems[j]; + if (pb != null) { + System.out.print("got pb: new Problem(\"" + pb.getLocation() + "\", \"" + pb.getMessage() + "\", \"" + pb.getResourcePath() + "\""); + System.out.print(", " + pb.getStart() + ", " + pb.getEnd() + ", " + pb.getCategoryId()+ ", " + pb.getSeverity()); + System.out.println(")"); + } + } + */ + System.out.println("--------------------------------------------------------------------------------"); + System.out.println("Missing problem while running test "+getName()+":"); + System.out.println(" - expected : " + problem); + System.out.println(" - current: " + arrayToString(rootProblems)); + assumeTrue("missing expected problem: " + problem, false); + } + } + + /** Batch builds the workspace. + */ + protected void fullBuild() { + this.debugRequestor.clearResult(); + this.debugRequestor.activate(); + env.fullBuild(); + this.debugRequestor.deactivate(); + } + + /** Batch builds the given project. + */ + protected void fullBuild(IPath projectPath) { + this.debugRequestor.clearResult(); + this.debugRequestor.activate(); + env.fullBuild(projectPath); + this.debugRequestor.deactivate(); + } + + /** Incrementally builds the given project. + */ + protected void incrementalBuild(IPath projectPath) { + this.debugRequestor.clearResult(); + this.debugRequestor.activate(); + env.incrementalBuild(projectPath); + this.debugRequestor.deactivate(); + } + + /** Incrementally builds the workspace. + */ + protected void incrementalBuild() { + this.debugRequestor.clearResult(); + this.debugRequestor.activate(); + env.incrementalBuild(); + this.debugRequestor.deactivate(); + } + + protected void printProblems() { + printProblemsFor(env.getWorkspaceRootPath()); + } + + protected void printProblemsFor(IPath root) { + printProblemsFor(new IPath[] { root }); + } + + protected void printProblemsFor(IPath[] roots) { + for (int i = 0; i < roots.length; i++) { + IPath path = roots[i]; + + /* get the leaf problems for this type */ + Problem[] problems = env.getProblemsFor(path); + System.out.println(arrayToString(problems)); + System.out.println(); + } + } + + protected String arrayToString(Object[] array) { + StringBuilder buffer = new StringBuilder(); + int length = array == null ? 0 : array.length; + for (int i = 0; i < length; i++) { + if (array[i] != null) { + if (i > 0) buffer.append('\n'); + buffer.append(array[i].toString()); + } + } + return buffer.toString(); + } + + /** Sets up this test. + */ + protected void setUp() throws Exception { + super.setUp(); + + this.debugRequestor = new EfficiencyCompilerRequestor(); + Compiler.DebugRequestor = this.debugRequestor; + if (env == null) { + env = new TestingEnvironment(); + env.openEmptyWorkspace(); + } + env.resetWorkspace(); + + } + /** + * @see junit.framework.TestCase#tearDown() + */ + protected void tearDown() throws Exception { + env.resetWorkspace(); + JavaCore.setOptions(JavaCore.getDefaultOptions()); + super.tearDown(); + } + + /** + * Concatenate and sort all problems for given root paths. + * + * @param roots The path to get the problems + * @return All sorted problems of all given path + */ + Problem[] allSortedProblems(IPath[] roots) { + Problem[] allProblems = null; + for (int i = 0, max=roots.length; i> list = new ArrayList<>(Arrays.asList(classes)); + if (matchesCompliance(F_1_5)) { + list.add(Java50Tests.class); + list.add(PackageInfoTest.class); + list.add(ParticipantBuildTests.class); + list.add(AnnotationDependencyTests.class); + } + if (matchesCompliance(F_1_8)) { + list.add(Bug544921Test.class); + } + if (matchesCompliance(F_9)) { + list.add(LeakTestsAfter9.class); + list.add(Bug549646Test.class); + } + if (matchesCompliance(F_12)) { + list.add(Bug571363Test.class); + } + return list.toArray(new Class[0]); + } + + static boolean matchesCompliance(int level) { + int complianceLevels = getPossibleComplianceLevels(); + return complianceLevels >= level; + } + + public static Test buildTestSuite(Class evaluationTestClass, long ordering) { + TestSuite suite = new TestSuite(evaluationTestClass.getName()); + List tests = buildTestsList(evaluationTestClass, 0, ordering); + for (int index=0, size=tests.size(); index actualProblemMessages = new ArrayList<>(); + Problem[] problems = env.getProblemsFor(project, "org.eclipse.jdt.core.tests.compile.problem"); + if (problems != null) { + for (Problem problem : problems) { + actualProblemMessages.add(problem.getMessage()); + } + } + + List expectedProblemMessages = Arrays.asList(expectedProblemMessage); + assertEquals("expected compile problem not observed", + expectedProblemMessages, actualProblemMessages); + } + + protected static void expectNoCompileProblems(IPath project) { + List actualProblemMessages = new ArrayList<>(); + Problem[] problems = env.getProblemsFor(project, "org.eclipse.jdt.core.tests.compile.problem"); + if (problems != null) { + for (Problem problem : problems) { + actualProblemMessages.add(problem.getMessage()); + } + } + + List expectedProblemMessages = Collections.EMPTY_LIST; + assertEquals("expected no compile problems", + expectedProblemMessages, actualProblemMessages); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java new file mode 100644 index 0000000000..4b24418344 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java @@ -0,0 +1,1054 @@ +/******************************************************************************* + * Copyright (c) 2000, 2016 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.builder; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.preferences.IEclipsePreferences; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.core.JavaModel; +import org.eclipse.jdt.internal.core.JavaModelManager; +import org.eclipse.jdt.internal.core.JavaProject; + +import junit.framework.Test; + +@SuppressWarnings({"unchecked", "rawtypes"}) +public class BuildpathTests extends BuilderTests { + +public BuildpathTests(String name) { + super(name); +} + +public static Test suite() { + return buildTestSuite(BuildpathTests.class); +} +@Override +protected void setUp() throws Exception { + this.indexDisabledForTest = false; + super.setUp(); +} + +private String getJdkLevelProblem(String expectedRuntime, String path, int severity) { + Object target = JavaModel.getTarget(new Path(path).makeAbsolute(), true); + long libraryJDK = org.eclipse.jdt.internal.core.util.Util.getJdkLevel(target); + String jclRuntime = CompilerOptions.versionFromJdkLevel(libraryJDK); + StringBuilder jdkLevelProblem = new StringBuilder("Problem : Incompatible .class files version in required binaries. Project 'Project' is targeting a "); + jdkLevelProblem.append(expectedRuntime); + jdkLevelProblem.append(" runtime, but is compiled against '"); + jdkLevelProblem.append(path); + jdkLevelProblem.append("' which requires a "); + jdkLevelProblem.append(jclRuntime); + jdkLevelProblem.append(" runtime [ resource : range : <-1,-1> category : <10> severity : <"); + jdkLevelProblem.append(severity); + jdkLevelProblem.append(">]"); + return jdkLevelProblem.toString(); +} + +public void testClasspathFileChange() throws JavaModelException { + // create project with src folder, and alternate unused src2 folder + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + IPath classTest1 = env.addClass(root, "p1", "Test1", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Test1 extends Zork1 {}" //$NON-NLS-1$ + ); + // not yet on the classpath + IPath src2Path = env.addFolder(projectPath, "src2"); //$NON-NLS-1$ + IPath src2p1Path = env.addFolder(src2Path, "p1"); //$NON-NLS-1$ + env.addFile(src2p1Path, "Zork1.java", //$NON-NLS-1$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Zork1 {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingSpecificProblemFor(classTest1, new Problem("src", "Zork1 cannot be resolved to a type", classTest1,39, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + //---------------------------- + // Step 2 + //---------------------------- + StringBuilder buffer = new StringBuilder("\n"); //$NON-NLS-1$ + buffer.append("\n"); //$NON-NLS-1$ + buffer.append(" \n"); //$NON-NLS-1$ + buffer.append(" \n"); // add src2 on classpath through resource change //$NON-NLS-1$ + String[] classlibs = Util.getJavaClassLibs(); + for (int i = 0; i < classlibs.length; i++) { + buffer.append(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + buffer.append(" \n"); //$NON-NLS-1$ + buffer.append(""); //$NON-NLS-1$ + boolean wasAutoBuilding = env.isAutoBuilding(); + try { + // turn autobuild on + env.setAutoBuilding(true); + // write new .classpath, will trigger autobuild + env.addFile(projectPath, ".classpath", buffer.toString()); //$NON-NLS-1$ + // ensures the builder did see the classpath change + env.waitForAutoBuild(); + expectingNoProblems(); + } finally { + env.setAutoBuilding(wasAutoBuilding); + } +} + +public void testClosedProject() throws JavaModelException, IOException { + IPath project1Path = env.addProject("CP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath jarPath = addEmptyInternalJar(project1Path, "temp.jar"); + + IPath project2Path = env.addProject("CP2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + + IPath project3Path = env.addProject("CP3"); //$NON-NLS-1$ + env.addExternalJars(project3Path, Util.getJavaClassLibs()); + env.addExternalJar(project3Path, jarPath.toString()); + + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.closeProject(project1Path); + + incrementalBuild(); + expectingOnlyProblemsFor(new IPath[] {project2Path, project3Path}); + expectingOnlySpecificProblemsFor(project2Path, + new Problem[] { + new Problem("", "The project cannot be built until build path errors are resolved", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ + new Problem("Build path", "Project 'CP2' is missing required Java project: 'CP1'", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + } + ); + expectingOnlySpecificProblemsFor(project3Path, + new Problem[] { + new Problem("", "The project cannot be built until build path errors are resolved", project3Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ + new Problem("Build path", "Project 'CP3' is missing required library: '/CP1/temp.jar'", project3Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + } + ); + + env.openProject(project1Path); + incrementalBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 3 + //---------------------------- + Hashtable options = JavaCore.getOptions(); + options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); + JavaCore.setOptions(options); + env.closeProject(project1Path); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + expectingOnlyProblemsFor(new IPath[] {project2Path, project3Path}); + expectingOnlySpecificProblemFor(project2Path, + new Problem("Build path", "Project 'CP2' is missing required Java project: 'CP1'", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + ); + expectingOnlySpecificProblemFor(project3Path, + new Problem("Build path", "Project 'CP3' is missing required library: '/CP1/temp.jar'", project3Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + ); + + env.openProject(project1Path); + incrementalBuild(); + expectingNoProblems(); + env.removeProject(project1Path); +} + +public void testCorruptBuilder() throws JavaModelException { + IPath project1Path = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(project1Path, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;" + //$NON-NLS-1$ + "public class Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + IPath outputFolderPackage = env.getOutputLocation(project1Path).append("p"); //$NON-NLS-1$ + env.removeBinaryClass(outputFolderPackage, "Test"); //$NON-NLS-1$ + + IPath subTest = env.addClass(project1Path, "", "SubTest", //$NON-NLS-1$ //$NON-NLS-2$ + "public class SubTest extends p.Test {}" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingOnlySpecificProblemFor(subTest, new Problem("", "p.Test cannot be resolved to a type", subTest, 29, 35, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$) + + env.addClass(project1Path, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;" + //$NON-NLS-1$ + "public class Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + Hashtable options = JavaCore.getOptions(); + options.put(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER, JavaCore.ENABLED); + JavaCore.setOptions(options); + + env.removeBinaryClass(outputFolderPackage, "Test"); //$NON-NLS-1$ + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removeProject(project1Path); +} + +public void testCorruptBuilder2() throws JavaModelException { + IPath project1Path = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(project1Path, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(project1Path, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(project1Path, "bin"); //$NON-NLS-1$ + + env.addClass(src, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;" + //$NON-NLS-1$ + "public class Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + IPath outputFolderPackage = bin.append("p"); //$NON-NLS-1$ + env.removeBinaryClass(outputFolderPackage, "Test"); //$NON-NLS-1$ + + IPath subTest = env.addClass(src, "p2", "SubTest", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;" + //$NON-NLS-1$ + "public class SubTest extends p.Test {}" //$NON-NLS-1$ + ); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemFor(subTest, new Problem("", "p.Test cannot be resolved to a type", subTest, 40, 46, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$) + + env.addClass(src, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;" + //$NON-NLS-1$ + "public class Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + Hashtable options = JavaCore.getOptions(); + options.put(JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER, JavaCore.ENABLED); + JavaCore.setOptions(options); + + env.removeBinaryClass(outputFolderPackage, "Test"); //$NON-NLS-1$ + env.waitForManualRefresh(); + incrementalBuild(); + expectingNoProblems(); + env.removeProject(project1Path); +} + +/* + * Ensures that changing a type in an external folder and refreshing triggers a rebuild + */ +public void testChangeExternalFolder() throws CoreException { + String externalLib = Util.getOutputDirectory() + File.separator + "externalLib"; + IPath projectPath = env.addProject("Project"); + try { + new File(externalLib).mkdirs(); + Util.compile( + new String[] { + "p/X.java", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " }\n" + + "}" + }, + new HashMap(), + externalLib + ); + + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.addExternalFolders(projectPath, new String[] {externalLib}); + + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + env.setOutputFolder(projectPath, ""); + + IPath classY = env.addClass(root, "q", "Y", + "package q;\n"+ + "public class Y {\n" + + " void bar(p.X x) {\n" + + " x.foo();\n" + + " }\n" + + "}" + ); + + fullBuild(projectPath); + env.waitForAutoBuild(); + expectingNoProblems(); + + String externalClassFile = externalLib + File.separator + "p" + File.separator + "X.class"; + long lastModified = new java.io.File(externalClassFile).lastModified(); + try { + Thread.sleep(1000); + } catch(InterruptedException e) { + } + Util.compile( + new String[] { + "p/X.java", + "package p;\n" + + "public class X {\n" + + "}" + }, + new HashMap(), + externalLib + ); + new java.io.File(externalClassFile).setLastModified(lastModified + 1000); // to be sure its different + + env.getProject(projectPath).refreshLocal(IResource.DEPTH_INFINITE, null); + env.waitForManualRefresh(); + + incrementalBuild(projectPath); + env.waitForAutoBuild(); + expectingProblemsFor( + classY, + "Problem : The method foo() is undefined for the type X [ resource : range : <54,57> category : <50> severity : <2>]" + ); + } finally { + new File(externalLib).delete(); + env.removeProject(projectPath); + } +} + +/* + * Ensures that changing a type in an external ZIP archive and refreshing triggers a rebuild + */ +public void testChangeZIPArchive1() throws Exception { + String externalLib = Util.getOutputDirectory() + File.separator + "externalLib.abc"; + IPath projectPath = env.addProject("Project"); + try { + org.eclipse.jdt.core.tests.util.Util.createJar( + new String[] { + "p/X.java", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " }\n" + + "}" + }, + externalLib, + "1.4"); + + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.addExternalJars(projectPath, new String[] {externalLib}); + + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + env.setOutputFolder(projectPath, ""); + + IPath classY = env.addClass(root, "q", "Y", + "package q;\n"+ + "public class Y {\n" + + " void bar(p.X x) {\n" + + " x.foo();\n" + + " }\n" + + "}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + org.eclipse.jdt.core.tests.util.Util.createJar( + new String[] { + "p/X.java", + "package p;\n" + + "public class X {\n" + + "}" + }, + externalLib, + "1.4"); + + IJavaProject p = env.getJavaProject(projectPath); + p.getJavaModel().refreshExternalArchives(new IJavaElement[] {p}, null); + + incrementalBuild(projectPath); + expectingProblemsFor( + classY, + "Problem : The method foo() is undefined for the type X [ resource : range : <54,57> category : <50> severity : <2>]" + ); + } finally { + new File(externalLib).delete(); + env.removeProject(projectPath); + } +} + +/* + * Ensures that changing a type in an internal ZIP archive and refreshing triggers a rebuild + */ +public void testChangeZIPArchive2() throws Exception { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + String internalLib = env.getProject("Project").getLocation().toOSString() + File.separator + "internalLib.abc"; + org.eclipse.jdt.core.tests.util.Util.createJar( + new String[] { + "p/X.java", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " }\n" + + "}" + }, + internalLib, + "1.4"); + env.getProject(projectPath).refreshLocal(IResource.DEPTH_INFINITE, null); + env.addEntry(projectPath, JavaCore.newLibraryEntry(new Path("/Project/internalLib.abc"), null, null)); + + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + env.setOutputFolder(projectPath, ""); + + IPath classY = env.addClass(root, "q", "Y", + "package q;\n"+ + "public class Y {\n" + + " void bar(p.X x) {\n" + + " x.foo();\n" + + " }\n" + + "}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + if (Util.isMacOS()) { + // Wait a moment so the jar timestamp will be different + Thread.sleep(2000); + } + + org.eclipse.jdt.core.tests.util.Util.createJar( + new String[] { + "p/X.java", + "package p;\n" + + "public class X {\n" + + "}" + }, + internalLib, + "1.4"); + + env.getProject(projectPath).refreshLocal(IResource.DEPTH_INFINITE, null); + + incrementalBuild(projectPath); + expectingProblemsFor( + classY, + "Problem : The method foo() is undefined for the type X [ resource : range : <54,57> category : <50> severity : <2>]" + ); + env.removeProject(projectPath); +} + +/* + * Ensures that changing an external jar and refreshing the projects triggers a rebuild + * (regression test for bug 50207 Compile errors fixed by 'refresh' do not reset problem list or package explorer error states) + */ +public void testExternalJarChange() throws JavaModelException, IOException { + // setup + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + IPath classTest = env.addClass(root, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class X {\n" + //$NON-NLS-1$ + " void foo() {\n" + //$NON-NLS-1$ + " new q.Y().bar();\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + String externalJar = Util.getOutputDirectory() + File.separator + "test.jar"; //$NON-NLS-1$ + Util.createJar( + new String[] { + "q/Y.java", //$NON-NLS-1$ + "package q;\n" + //$NON-NLS-1$ + "public class Y {\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + }, + new HashMap(), + externalJar + ); + env.addExternalJar(projectPath, externalJar); + + // build -> expecting problems + fullBuild(); + expectingProblemsFor( + classTest, + "Problem : The method bar() is undefined for the type Y [ resource : range : <57,60> category : <50> severity : <2>]" + ); + + // fix jar + Util.createJar( + new String[] { + "q/Y.java", //$NON-NLS-1$ + "package q;\n" + //$NON-NLS-1$ + "public class Y {\n" + //$NON-NLS-1$ + " public void bar() {\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + }, + new HashMap(), + externalJar + ); + + // refresh project and rebuild -> expecting no problems + IJavaProject project = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject("Project")); //$NON-NLS-1$ + project.getJavaModel().refreshExternalArchives(new IJavaElement[] {project}, null); + incrementalBuild(); + expectingNoProblems(); + env.removeProject(projectPath); +} + +public void testMissingBuilder() throws JavaModelException { + IPath project1Path = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + IPath project2Path = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + + env.addClass(project1Path, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Test {}" //$NON-NLS-1$ + ); + + IPath sub = env.addClass(project2Path, "", "SubTest", //$NON-NLS-1$ //$NON-NLS-2$ + "public class SubTest extends Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + env.removeRequiredProject(project2Path, project1Path); + + incrementalBuild(); + expectingOnlySpecificProblemFor(sub, new Problem("", "Test cannot be resolved to a type", sub, 29, 33, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$) + + env.addRequiredProject(project2Path, project1Path); + + try { + JavaProject p = (JavaProject) env.getJavaProject(project1Path); + p.deconfigure(); + JavaModelManager.getJavaModelManager().setLastBuiltState(p.getProject(), null); + } catch (CoreException e) { + e.printStackTrace(); + } + + env.addClass(project2Path, "", "SubTest", //$NON-NLS-1$ //$NON-NLS-2$ + "public class SubTest extends Test {}" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); +} + +public void testMissingFieldType() throws JavaModelException { + IPath projectPath = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + env.addClass(root, "p1", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + IPath projectPath2 = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + env.addRequiredProject(projectPath2, projectPath); + IPath root2 = env.getPackageFragmentRootPath(projectPath2, ""); //$NON-NLS-1$ + env.addClass(root2, "p2", "Test2", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Test2 {\n" + //$NON-NLS-1$ + " public static p1.Test field;\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + + IPath projectPath3 = env.addProject("Project3"); //$NON-NLS-1$ + env.addExternalJars(projectPath3, Util.getJavaClassLibs()); + env.addRequiredProject(projectPath3, projectPath2); + IPath root3 = env.getPackageFragmentRootPath(projectPath3, ""); //$NON-NLS-1$ + env.addClass(root3, "p3", "Test3", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class Test3 extends p2.Test2 {\n" + //$NON-NLS-1$ + " static Object field;\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + env.removeProject(projectPath); +} + +public void testMissingLibrary1() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + IPath classTest1 = env.addClass(root, "p1", "Test1", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Test1 {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlyProblemsFor(new IPath[] {projectPath, classTest1}); + expectingOnlySpecificProblemsFor(projectPath, + new Problem[] { + new Problem("", "The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p1", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files", classTest1, 0, 1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + } + ); + + //---------------------------- + // Step 2 + //---------------------------- + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + incrementalBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[]{ + bin.append("p1").append("Test1.class"), //$NON-NLS-1$ //$NON-NLS-2$ + }); + env.removeProject(projectPath); +} + +public void testMissingLibrary2() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + IPath classTest1 = env.addClass(root, "p2", "Test1", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Test1 {}" //$NON-NLS-1$ + ); + IPath classTest2 = env.addClass(root, "p2", "Test2", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Test2 {}" //$NON-NLS-1$ + ); + IPath classTest3 = env.addClass(root, "p3", "Test3", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class Test3 {}" //$NON-NLS-1$ + ); + + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor( + projectPath, + new Problem("", "The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + Problem[] prob1 = env.getProblemsFor(classTest1); + Problem[] prob2 = env.getProblemsFor(classTest2); + Problem[] prob3 = env.getProblemsFor(classTest3); + assertEquals("too many problems", prob1.length + prob2.length + prob3.length, 1); //$NON-NLS-1$ + if(prob1.length == 1) { + expectingSpecificProblemFor(classTest1, new Problem("p2", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files", classTest1, 0, 1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } else if (prob2.length == 1) { + expectingSpecificProblemFor(classTest2, new Problem("p2", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files", classTest2, -1, -1, -1, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + expectingSpecificProblemFor(classTest3, new Problem("p3", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files", classTest3, -1, -1, -1, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + //---------------------------- + // Step 2 + //---------------------------- + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[]{ + bin.append("p2").append("Test1.class"), //$NON-NLS-1$ //$NON-NLS-2$ + bin.append("p2").append("Test2.class"), //$NON-NLS-1$ //$NON-NLS-2$ + bin.append("p3").append("Test3.class") //$NON-NLS-1$ //$NON-NLS-2$ + }); + env.removeProject(projectPath); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=172345 +public void testMissingLibrary3() throws JavaModelException { + this.abortOnFailure = false; // this test is failing on some releng boxes => do not abort on failures + IPath projectPath = env.addProject("Project"); + IJavaProject project = env.getJavaProject(projectPath); + fullBuild(); + expectingNoProblems(); + project.setOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, CompilerOptions.WARNING); + env.waitForManualRefresh(); + env.addLibrary(projectPath, projectPath.append("/lib/dummy.jar"), null, null); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor( + projectPath, + new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, + IMarker.SEVERITY_WARNING)); + project.setOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, CompilerOptions.ERROR); + env.waitForManualRefresh(); + // force classpath change delta - should not have to do this + IClasspathEntry[] classpath = project.getRawClasspath(); + IPath outputLocation; + project.setRawClasspath(null, outputLocation = project.getOutputLocation(), false, null); + project.setRawClasspath(classpath, outputLocation, false, null); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor( + projectPath, + new Problem("", "The project cannot be built until build path errors are resolved", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); + expectingSpecificProblemFor( + projectPath, + new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); + env.removeProject(projectPath); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=172345 +public void testMissingLibrary4() throws JavaModelException { + this.abortOnFailure = false; // this test is failing on some releng boxes => do not abort on failures + IPath projectPath = env.addProject("Project"); + IJavaProject project = env.getJavaProject(projectPath); + fullBuild(); + expectingNoProblems(); + env.addLibrary(projectPath, projectPath.append("/lib/dummy.jar"), null, null); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor( + projectPath, + new Problem("", "The project cannot be built until build path errors are resolved", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); + expectingSpecificProblemFor( + projectPath, + new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); + project.setOption(JavaCore.CORE_INCOMPLETE_CLASSPATH, CompilerOptions.WARNING); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForManualRefresh(); + expectingSpecificProblemFor( + projectPath, + new Problem("Build path", "Project 'Project' is missing required library: 'lib/dummy.jar'", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, + IMarker.SEVERITY_WARNING)); + env.removeProject(projectPath); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=172345 +public void testIncompatibleJdkLEvelOnProject() throws JavaModelException { + + // Create project + IPath projectPath = env.addProject("Project"); + IJavaProject project = env.getJavaProject(projectPath); + String[] classlibs = Util.getJavaClassLibs(); + env.addExternalJars(projectPath, classlibs); + Arrays.sort(classlibs); + + // Build it expecting no problem + fullBuild(); + expectingNoProblems(); + + // Build incompatible jdk level problem string + String projectRuntime = project.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, true); + + // Change project incompatible jdk level preferences to warning, perform incremental build and expect 1 problem + project.setOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, CompilerOptions.WARNING); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + long projectRuntimeJDKLevel = CompilerOptions.versionToJdkLevel(projectRuntime); + int max = classlibs.length; + List expectedProblems = new ArrayList(); + for (int i = 0; i < max; i++) { + String path = project.getPackageFragmentRoot(classlibs[i]).getPath().makeRelative().toString(); + Object target = JavaModel.getTarget(new Path(path).makeAbsolute(), true); + long libraryJDK = org.eclipse.jdt.internal.core.util.Util.getJdkLevel(target); + if (libraryJDK > projectRuntimeJDKLevel) { + expectedProblems.add(getJdkLevelProblem(projectRuntime, path, IMarker.SEVERITY_WARNING)); + } + } + expectingProblemsFor(projectPath, expectedProblems); + + // Change project incompatible jdk level preferences to error, perform incremental build and expect 2 problems + project.setOption(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, CompilerOptions.ERROR); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + + expectedProblems = new ArrayList(); + for (int i = 0; i < max; i++) { + String path = project.getPackageFragmentRoot(classlibs[i]).getPath().makeRelative().toString(); + Object target = JavaModel.getTarget(new Path(path).makeAbsolute(), true); + long libraryJDK = org.eclipse.jdt.internal.core.util.Util.getJdkLevel(target); + if (libraryJDK > projectRuntimeJDKLevel) { + expectedProblems.add(getJdkLevelProblem(projectRuntime, path, IMarker.SEVERITY_ERROR)); + } + } + expectedProblems.add("Problem : The project cannot be built until build path errors are resolved [ resource : range : <-1,-1> category : <10> severity : <2>]"); + expectingProblemsFor(projectPath, expectedProblems); + + // Remove project to avoid side effect on other tests + env.removeProject(projectPath); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=172345 +public void testIncompatibleJdkLEvelOnWksp() throws JavaModelException { + + // Save preference + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + IEclipsePreferences preferences = manager.getInstancePreferences(); + String incompatibleJdkLevel = preferences.get(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, null); + try { + + // Create project + IPath projectPath = env.addProject("Project"); + IJavaProject project = env.getJavaProject(projectPath); + String[] classlibs = Util.getJavaClassLibs(); + env.addExternalJars(projectPath, classlibs); + + // Build it expecting no problem + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + // Build incompatible jdk level problem string + String wkspRuntime = JavaCore.getOption(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM); + long wkspRuntimeJDKLevel = CompilerOptions.versionToJdkLevel(wkspRuntime); + // sort classlibs + Arrays.sort(classlibs); + // Change workspace incompatible jdk level preferences to warning, perform incremental build and expect 1 problem + preferences.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.WARNING); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + List expectedProblems = new ArrayList(); + int max = classlibs.length; + for (int i = 0; i < max; i++) { + String path = project.getPackageFragmentRoot(classlibs[i]).getPath().makeRelative().toString(); + Object target = JavaModel.getTarget(new Path(path).makeAbsolute(), true); + long libraryJDK = org.eclipse.jdt.internal.core.util.Util.getJdkLevel(target); + if (libraryJDK > wkspRuntimeJDKLevel) { + expectedProblems.add(getJdkLevelProblem(wkspRuntime, path, IMarker.SEVERITY_WARNING)); + } + } + expectingProblemsFor(projectPath, expectedProblems); + + // Change workspace incompatible jdk level preferences to error, perform incremental build and expect 2 problems + preferences.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, JavaCore.ERROR); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + expectedProblems = new ArrayList(); + for (int i = 0; i < max; i++) { + String path = project.getPackageFragmentRoot(classlibs[i]).getPath().makeRelative().toString(); + Object target = JavaModel.getTarget(new Path(path).makeAbsolute(), true); + long libraryJDK = org.eclipse.jdt.internal.core.util.Util.getJdkLevel(target); + if (libraryJDK > wkspRuntimeJDKLevel) { + expectedProblems.add(getJdkLevelProblem(wkspRuntime, path, IMarker.SEVERITY_ERROR)); + } + } + expectedProblems.add("Problem : The project cannot be built until build path errors are resolved [ resource : range : <-1,-1> category : <10> severity : <2>]"); + expectingProblemsFor(projectPath, expectedProblems); + + // Remove project to avoid side effect on other tests + env.removeProject(projectPath); + } finally { + // Put back workspace preferences same as before running the test + if (incompatibleJdkLevel == null) { + preferences.remove(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL); + } else { + preferences.put(JavaCore.CORE_INCOMPATIBLE_JDK_LEVEL, incompatibleJdkLevel); + } + } +} + +public void testMissingProject() throws JavaModelException { + IPath project1Path = env.addProject("MP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + IPath project2Path = env.addProject("MP2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.removeProject(project1Path); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingOnlyProblemsFor(project2Path); + expectingOnlySpecificProblemsFor(project2Path, + new Problem[] { + new Problem("", "The project cannot be built until build path errors are resolved", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ + new Problem("Build path", "Project 'MP2' is missing required Java project: 'MP1'", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + } + ); + + project1Path = env.addProject("MP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 3 + //---------------------------- + Hashtable options = JavaCore.getOptions(); + options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); + JavaCore.setOptions(options); + env.waitForManualRefresh(); + env.removeProject(project1Path); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingOnlyProblemsFor(project2Path); + expectingOnlySpecificProblemFor(project2Path, + new Problem("Build path", "Project 'MP2' is missing required Java project: 'MP1'", project2Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ + ); + + project1Path = env.addProject("MP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); +} + +public void testMissingOptionalProject() throws JavaModelException { + IPath project1Path = env.addProject("MP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + IPath project2Path = env.addProject("MP2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, true/*optional*/); + + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.removeProject(project1Path); + + incrementalBuild(); + expectingNoProblems(); + + project1Path = env.addProject("MP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + incrementalBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 3 + //---------------------------- + Hashtable options = JavaCore.getOptions(); + options.put(JavaCore.CORE_JAVA_BUILD_INVALID_CLASSPATH, JavaCore.IGNORE); + JavaCore.setOptions(options); + env.waitForManualRefresh(); + env.removeProject(project1Path); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + project1Path = env.addProject("MP1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + incrementalBuild(); + expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 +public void test0100() throws JavaModelException { + if (!AbstractCompilerTest.isJRELevel(AbstractCompilerTest.F_1_5)) { + // expected to run only in 1.5 mode on top of a jre 1.5 or above + return; + } + IPath projectPath = env.addProject("P", "1.5"); + IPath defaultPackagePath = env.addPackage(projectPath, ""); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.addClass(defaultPackagePath, "X", + "public interface X {\n" + + " interface Entry {\n" + + " interface Internal extends Entry {\n" + + " Internal createEntry();\n" + + " }\n" + + " }\n" + + "}" + ); + fullBuild(); + expectingNoProblems(); + env.addClass(defaultPackagePath, "Y", + "public class Y implements X.Entry.Internal {\n" + + " public Internal createEntry() {\n" + + " return null;\n" + + " }\n" + + "}"); + incrementalBuild(); + expectingNoProblems(); + env.removeProject(projectPath); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=143025 +public void testMissingOutputFolder() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + fullBuild(); + expectingNoProblems(); + + env.removeFolder(bin); + + incrementalBuild(); + expectingNoProblems(); + expectingPresenceOf(bin); // check that bin folder was recreated and is marked as derived + if (!env.getProject(projectPath).getFolder("bin").isDerived()) + fail("output folder is not derived"); + env.removeProject(projectPath); +} +@Override +protected void tearDown() throws Exception { + super.tearDown(); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompressedWriterTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompressedWriterTest.java new file mode 100644 index 0000000000..291d969628 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CompressedWriterTest.java @@ -0,0 +1,148 @@ +/******************************************************************************* + * Copyright (c) 2021 jkubitz 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: + * jkubitz - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.util.Arrays; + +import org.eclipse.jdt.internal.core.builder.CompressedReader; +import org.eclipse.jdt.internal.core.builder.CompressedWriter; + +import junit.framework.Test; + +public class CompressedWriterTest extends BuilderTests { + + private CompressedWriter writer; + private CompressedReader reader; + + public CompressedWriterTest(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(CompressedWriterTest.class); + } + + private void start() throws Exception { + DataOutputStream out; + DataInputStream in; + PipedInputStream pis; + pis = new PipedInputStream(1000000); + PipedOutputStream pos = new PipedOutputStream(pis); + + out = new DataOutputStream(pos); + this.writer = new CompressedWriter(out); + + in = new DataInputStream(pis); + this.reader = new CompressedReader(in); + } + + private void stop() throws Exception { + // not realy necessary since its only "resource" in memory + this.writer = null; + this.reader = null; + } + + public void testWriteRead() throws Exception { + start(); + try { + // test multiple times since output depends on context (lastName, dictionary) + for (int i = 1; i < 3; i++) { + assertReadWhatsWritten(); + } + } finally { + stop(); + } + } + + private void assertReadWhatsWritten() throws Exception { + assertSame(new Integer[] { 0, 1, -1, 2, -2, (int) Byte.MAX_VALUE, (int) Byte.MIN_VALUE }, + (w, v) -> w.writeByte(v.intValue()), r -> Integer.valueOf(r.readByte())); + assertSame(new Boolean[] { true, false }, (w, v) -> w.writeBoolean(v.booleanValue()), + r -> Boolean.valueOf(r.readBoolean())); + assertSame(new Integer[] { 0, 1, -1, 2, -2, Integer.MAX_VALUE, Integer.MIN_VALUE }, + (w, v) -> w.writeInt(v.intValue()), r -> Integer.valueOf(r.readInt())); + assertSame(new Long[] { 0L, 1L, -1L, 2L, -2L, Long.MAX_VALUE, Long.MIN_VALUE }, + (w, v) -> w.writeLong(v.longValue()), r -> Long.valueOf(r.readLong())); + + int[] ranges = new int[] { 5, Byte.MAX_VALUE, Byte.MAX_VALUE - 1, Byte.MAX_VALUE + 1, 254, 255, 256, 0xffff - 1, + 0xffff, 0xffff + 1, 0xfffff, 0xfffff + 1, 0xffffff - 1, 0xffffff, 0xffffff + 1, 0xffffffff - 1, + 0xffffffff, 0x12, 0x1234, 0x123456, 0x12345678 }; + for (int range : ranges) { + assertSame(new Integer[] { 0, 1, 2, range - 1 }, (w, v) -> w.writeIntInRange(v.intValue(), range), + r -> Integer.valueOf(r.readIntInRange(range))); + } + + int[] typical1 = new int[] { 0, 1, -1, 2, -2, Integer.MAX_VALUE, Integer.MIN_VALUE }; + int[] typical2 = new int[] { 3 }; + int[] typical3 = new int[] {}; + int[] typical4 = new int[] { 1, 1 }; + assertSame(new Integer[] { 0, 1, -1, 2, -2, Integer.MAX_VALUE, Integer.MIN_VALUE }, + (w, v) -> w.writeIntWithHint(v.intValue(), typical1), + r -> Integer.valueOf(r.readIntWithHint(typical1))); + assertSame(new Integer[] { 0, 1, -1, 2, -2, Integer.MAX_VALUE, Integer.MIN_VALUE }, + (w, v) -> w.writeIntWithHint(v.intValue(), typical2), + r -> Integer.valueOf(r.readIntWithHint(typical2))); + assertSame(new Integer[] { 0, 1, -1, 2, -2, Integer.MAX_VALUE, Integer.MIN_VALUE }, + (w, v) -> w.writeIntWithHint(v.intValue(), typical3), + r -> Integer.valueOf(r.readIntWithHint(typical3))); + assertSame(new Integer[] { 0, 1, -1, 2, -2, Integer.MAX_VALUE, Integer.MIN_VALUE }, + (w, v) -> w.writeIntWithHint(v.intValue(), typical4), + r -> Integer.valueOf(r.readIntWithHint(typical4))); + + String[] strings = new String[] { "nix", "xx", "xxxy", "xyz", "", "xxy", "z", "z", "xyz", "xu", "-".repeat(254), + "-".repeat(255), "-".repeat(256), "-".repeat(257), "-".repeat(60000) }; + char[][] chars = Arrays.stream(strings).map(String::toCharArray).toArray(char[][]::new); + assertSame(strings, (w, v) -> w.writeStringUsingDictionary(v), r -> r.readStringUsingDictionary()); + assertSame(chars, (w, v) -> w.writeChars(v), r -> r.readChars()); + assertSame(chars, (w, v) -> w.writeCharsUsingLast(v), r -> r.readCharsUsingLast()); + assertSame(strings, (w, v) -> w.writeStringUsingLast(v), r -> r.readStringUsingLast()); + } + + @FunctionalInterface + public interface ExceptionalBiConsumer { + void accept(T t, U u) throws Exception; + } + + @FunctionalInterface + public interface ExceptionalFunction { + R apply(T t) throws Exception; + } + + private void assertSame(V[] vs, ExceptionalBiConsumer write, + ExceptionalFunction read) throws Exception { + for (V v : vs) { + assertEquals(v, write, read); + } + + } + + private void assertEquals(V in, ExceptionalBiConsumer write, + ExceptionalFunction read) throws Exception { + Object input = charToStringOrSame(in); +// System.out.println("writing " + input); + write.accept(this.writer, in); + V out = read.apply(this.reader); // may block if written too less + Object output = charToStringOrSame(out); + assertEquals(in.getClass(), out.getClass()); + assertEquals(input, output); + } + + private Object charToStringOrSame(Object v) { + return (v instanceof char[]) ? new String((char[]) v) : v; + } +} \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java new file mode 100644 index 0000000000..58d2a067f3 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/CopyResourceTests.java @@ -0,0 +1,357 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import junit.framework.*; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +/** + * Basic tests of the image builder. + */ +@SuppressWarnings({"rawtypes", "unchecked"}) +public class CopyResourceTests extends BuilderTests { + + public CopyResourceTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(CopyResourceTests.class); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=117302 + public void testFilteredResources() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot( + projectPath, + "", //$NON-NLS-1$ + new IPath[] {new org.eclipse.core.runtime.Path("foo/;bar/")}, //$NON-NLS-1$ + new IPath[] {new org.eclipse.core.runtime.Path("foo/ignored/")}, //$NON-NLS-1$ + "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src, "foo", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package foo;"+ //$NON-NLS-1$ + "public class A extends bar.B {}" //$NON-NLS-1$ + ); + env.addClass(src, "bar", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package bar;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + env.addFolder(src, "foo/skip"); //$NON-NLS-1$ + IPath ignored = env.addFolder(src, "foo/ignored"); //$NON-NLS-1$ + env.addFile(ignored, "test.txt", "test file"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + env.addFile(src.append("bar"), "test.txt", "test file"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + org.eclipse.jdt.core.IJavaProject p = env.getJavaProject("P"); + java.util.Map options = p.getOptions(true); + options.put(org.eclipse.jdt.core.JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, "bar*"); //$NON-NLS-1$ + options.put(org.eclipse.jdt.core.JavaCore.CORE_JAVA_BUILD_RECREATE_MODIFIED_CLASS_FILES_IN_OUTPUT_FOLDER, "enabled"); //$NON-NLS-1$ + p.setOptions(options); + + int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; + fullBuild(); + expectingNoProblems(); + expectingNoPresenceOf(projectPath.append("bin/foo/skip/")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin/foo/ignored/")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin/bar/test.txt")); //$NON-NLS-1$ + + env.removeFolder(projectPath.append("bin/bar")); //$NON-NLS-1$ + env.addClass(src, "x", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package x;"+ //$NON-NLS-1$ + "public class A extends bar.B {}" //$NON-NLS-1$ + ); + env.addFile(src.append("bar"), "test.txt", "changed test file"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + incrementalBuild(); + expectingNoProblems(); + expectingNoPresenceOf(projectPath.append("bin/foo/skip/")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin/foo/ignored/")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin/bar/test.txt")); //$NON-NLS-1$ + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; + } + } + + public void testSimpleProject() throws JavaModelException { + IPath projectPath = env.addProject("P1"); //$NON-NLS-1$ + IPath src = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + env.setOutputFolder(projectPath, ""); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addFile(src, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(projectPath.append("z.txt")); //$NON-NLS-1$ + + env.removeFile(src.append("z.txt")); //$NON-NLS-1$ + IPath p = env.addFolder(src, "p"); //$NON-NLS-1$ + env.addFile(p, "p.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + incrementalBuild(); + expectingNoProblems(); + expectingNoPresenceOf(projectPath.append("z.txt")); //$NON-NLS-1$ + expectingPresenceOf(p.append("p.txt")); //$NON-NLS-1$ + } + + public void testProjectWithBin() throws JavaModelException { + IPath projectPath = env.addProject("P2"); //$NON-NLS-1$ + IPath src = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addFile(src, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("z.txt"), //$NON-NLS-1$ + projectPath.append("bin/z.txt") //$NON-NLS-1$ + }); + + env.removeFile(src.append("z.txt")); //$NON-NLS-1$ + IPath p = env.addFolder(src, "p"); //$NON-NLS-1$ + env.addFile(p, "p.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + incrementalBuild(); + expectingNoProblems(); + expectingNoPresenceOf(new IPath[] { + projectPath.append("z.txt"), //$NON-NLS-1$ + projectPath.append("bin/z.txt") //$NON-NLS-1$ + }); + expectingPresenceOf(new IPath[] { + projectPath.append("p/p.txt"), //$NON-NLS-1$ + projectPath.append("bin/p/p.txt") //$NON-NLS-1$ + }); + } + + public void testProjectWithSrcBin() throws JavaModelException { + IPath projectPath = env.addProject("P3"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addFile(src, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("src/z.txt"), //$NON-NLS-1$ + projectPath.append("bin/z.txt") //$NON-NLS-1$ + }); + + env.removeFile(src.append("z.txt")); //$NON-NLS-1$ + env.addFile(src, "zz.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + incrementalBuild(); + expectingNoProblems(); + expectingNoPresenceOf(new IPath[] { + projectPath.append("src/z.txt"), //$NON-NLS-1$ + projectPath.append("bin/z.txt") //$NON-NLS-1$ + }); + expectingPresenceOf(new IPath[] { + projectPath.append("src/zz.txt"), //$NON-NLS-1$ + projectPath.append("bin/zz.txt") //$NON-NLS-1$ + }); + } + + public void testProjectWith2SrcBin() throws JavaModelException { + IPath projectPath = env.addProject("P4"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1"); //$NON-NLS-1$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addFile(src1, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + env.addFile(src2, "zz.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("src1/z.txt"), //$NON-NLS-1$ + projectPath.append("bin/z.txt"), //$NON-NLS-1$ + projectPath.append("src2/zz.txt"), //$NON-NLS-1$ + projectPath.append("bin/zz.txt") //$NON-NLS-1$ + }); + + env.removeFile(src2.append("zz.txt")); //$NON-NLS-1$ + IPath p = env.addFolder(src2, "p"); //$NON-NLS-1$ + env.addFile(p, "p.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + incrementalBuild(); + expectingNoProblems(); + expectingNoPresenceOf(new IPath[] { + projectPath.append("src2/zz.txt"), //$NON-NLS-1$ + projectPath.append("bin/zz.txt") //$NON-NLS-1$ + }); + expectingPresenceOf(new IPath[] { + projectPath.append("src2/p/p.txt"), //$NON-NLS-1$ + projectPath.append("bin/p/p.txt") //$NON-NLS-1$ + }); + } + + public void testProjectWith2SrcAsBin() throws JavaModelException { + IPath projectPath = env.addProject("P5"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "src1"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2", null, "src2"); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addFile(src1, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + env.addFile(src2, "zz.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("src1/z.txt"), //$NON-NLS-1$ + projectPath.append("src2/zz.txt"), //$NON-NLS-1$ + }); + expectingNoPresenceOf(new IPath[] { + projectPath.append("src2/z.txt"), //$NON-NLS-1$ + projectPath.append("bin") //$NON-NLS-1$ + }); + } + + public void testProjectWith2Src2Bin() throws JavaModelException { + IPath projectPath = env.addProject("P6"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "bin1"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin1"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addFile(src1, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + env.addFile(src2, "zz.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("bin1/z.txt"), //$NON-NLS-1$ + projectPath.append("bin2/zz.txt"), //$NON-NLS-1$ + }); + expectingNoPresenceOf(new IPath[] { + projectPath.append("bin1/zz.txt"), //$NON-NLS-1$ + projectPath.append("bin2/z.txt"), //$NON-NLS-1$ + }); + } + + public void test2ProjectWith1Bin() throws JavaModelException { + IPath projectPath = env.addProject("P7"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath projectPath2 = env.addProject("P8"); //$NON-NLS-1$ + IPath binLocation = env.getProject(projectPath).getFolder("bin").getLocation(); //$NON-NLS-1$ + env.setExternalOutputFolder(projectPath2, "externalBin", binLocation); //$NON-NLS-1$ + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + + env.addFile(projectPath2, "z.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(bin.append("z.txt")); //$NON-NLS-1$ + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=154693 + public void testBug154693() throws JavaModelException { + IPath projectPath = env.addProject("P9"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + org.eclipse.jdt.core.IJavaProject p = env.getJavaProject("P9"); + java.util.Map options = p.getOptions(true); + options.put(org.eclipse.jdt.core.JavaCore.CORE_JAVA_BUILD_RESOURCE_COPY_FILTER, ".svn/"); //$NON-NLS-1$ + p.setOptions(options); + + IPath folder = env.addFolder(src, "p"); + env.addFolder(folder, ".svn"); + env.addFile(folder, "A.java", "package p;\nclass A{}"); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingNoPresenceOf(new IPath[] { + projectPath.append("bin/p/.svn") //$NON-NLS-1$ + }); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=194420 + public void testBug194420() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath folder = env.addFolder(src, "p"); + String testContents = "incremental test contents"; //$NON-NLS-1$ + IPath zPath = env.addFile(folder, "z.txt", testContents); //$NON-NLS-1$ + IPath zBinPath = bin.append("p/z.txt"); + org.eclipse.core.resources.IFile zFile = env.getWorkspace().getRoot().getFile(zPath); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(zBinPath); + try { + byte[] contents = new byte[testContents.length()]; + java.io.InputStream stream = zFile.getContents(); + stream.read(contents); + stream.close(); + assumeEquals("File was not copied", testContents, new String(contents)); //$NON-NLS-1$ + } catch (Exception e) { + fail("File was not copied"); //$NON-NLS-1$ + } + + java.io.File file = new java.io.File(zFile.getLocation().toOSString()); + file.delete(); + + fullBuild(); + expectingNoProblems(); + expectingNoPresenceOf(zBinPath); + + testContents = "incremental test contents"; //$NON-NLS-1$ + env.addFile(folder, "z.txt", testContents); //$NON-NLS-1$ + + incrementalBuild(); + expectingNoProblems(); + expectingPresenceOf(zBinPath); + try { + byte[] contents = new byte[testContents.length()]; + java.io.InputStream stream = zFile.getContents(); + stream.read(contents); + stream.close(); + assumeEquals("File was not copied", testContents, new String(contents)); //$NON-NLS-1$ + } catch (Exception e) { + fail("File was not copied"); //$NON-NLS-1$ + } + + env.addFile(folder, "z.txt", "about to be deleted"); //$NON-NLS-1$ //$NON-NLS-2$ + file.delete(); + + incrementalBuild(); + expectingNoProblems(); + expectingNoPresenceOf(zBinPath); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java new file mode 100644 index 0000000000..126c106ec0 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/DependencyTests.java @@ -0,0 +1,1258 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import junit.framework.Test; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class DependencyTests extends BuilderTests { + public DependencyTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(DependencyTests.class); + } + + public void testAbstractMethod() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Indicted", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class Indicted {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath collaboratorPath = env.addClass(root, "p2", "Collaborator", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Collaborator extends Indicted{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "Indicted", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class Indicted {\n"+ //$NON-NLS-1$ + " public abstract void foo();\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(collaboratorPath); + expectingOnlySpecificProblemFor(collaboratorPath, new Problem("Collaborator", "The type Collaborator must implement the inherited abstract method Indicted.foo()", collaboratorPath, 38, 50, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=168208 + public void testCaseInvariantType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + org.eclipse.jdt.core.IJavaProject p = env.getJavaProject("Project"); + java.util.Map options = p.getOptions(true); + options.put(org.eclipse.jdt.core.JavaCore.CORE_JAVA_BUILD_CLEAN_OUTPUT_FOLDER, org.eclipse.jdt.core.JavaCore.DISABLED); //$NON-NLS-1$ + p.setOptions(options); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n" + + " class Node {}\n" + + "}" //$NON-NLS-1$ + ); + + env.addClass(root, "p1", "Bb", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "class Bb {}" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n" + + " class node {}\n" + + "}" //$NON-NLS-1$ + ); + + env.addClass(root, "p1", "Bb", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "class BB {}" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testExactMethodDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i(int i) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " int j = i(1);\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath dPath = env.addClass(root, "p3", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class D extends p2.B{\n"+ //$NON-NLS-1$ + " public class M {\n"+ //$NON-NLS-1$ + " int j = i(1);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C c) { return c.i(1); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, dPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "The method i(int) is undefined for the type C", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(dPath, new Problem("D", "The method i(int) is undefined for the type D.M", dPath, 69, 70, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The method i(int) is undefined for the type C", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + " protected int i(long l) throws Exception {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, dPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "Default constructor cannot handle exception type Exception thrown by implicit super constructor. Must define an explicit constructor", cPath, 50, 54, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(dPath, new Problem("D", "Default constructor cannot handle exception type Exception thrown by implicit super constructor. Must define an explicit constructor", dPath, 69, 73, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The method i(long) from the type B is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i(int i) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testExactMethodVisibility() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i() {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " int j = i();\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath dPath = env.addClass(root, "p3", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class D extends p2.B{\n"+ //$NON-NLS-1$ + " public class M {\n"+ //$NON-NLS-1$ + " int j = i();\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C c) { return c.i(); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " int i() {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, dPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "The method i() from the type A is not visible", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(dPath, new Problem("D", "The method i() from the type A is not visible", dPath, 69, 70, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The method i() from the type A is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " protected int i() {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {xPath}); + expectingSpecificProblemFor(xPath, new Problem("X", "The method i() from the type A is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i() {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testExternalJarChanged() throws CoreException, java.io.IOException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + IPath classTest = env.addClass(root, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class X {\n" + //$NON-NLS-1$ + " void foo() {\n" + //$NON-NLS-1$ + " new q.Y().bar();\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + String externalJar = Util.getOutputDirectory() + java.io.File.separator + "test.jar"; //$NON-NLS-1$ + Util.createJar( + new String[] { + "q/Y.java", //$NON-NLS-1$ + "package q;\n" + //$NON-NLS-1$ + "public class Y {\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + }, + new java.util.HashMap(), + externalJar + ); + env.addExternalJar(projectPath, externalJar); + + // build -> expecting problems + fullBuild(); + expectingProblemsFor( + classTest, + "Problem : The method bar() is undefined for the type Y [ resource : range : <57,60> category : <50> severity : <2>]" + ); + + // fix jar + Util.createJar( + new String[] { + "q/Y.java", //$NON-NLS-1$ + "package q;\n" + //$NON-NLS-1$ + "public class Y {\n" + //$NON-NLS-1$ + " public void bar() {\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + }, + new java.util.HashMap(), + externalJar + ); + // add new class to trigger an incremental build + env.getProject(projectPath).touch(null); + + // incremental build should notice jar file has changed & do a full build + incrementalBuild(); + expectingNoProblems(); + } + + public void testFieldDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " int j = i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C c) { return c.i; }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "i cannot be resolved to a variable", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "i cannot be resolved or is not a field", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testFieldVisibility() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " int j = i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C c) { return c.i; }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " int i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "The field A.i is not visible", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The field A.i is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " protected int i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {xPath}); + expectingSpecificProblemFor(xPath, new Problem("X", "The field A.i is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + // 77272 + public void testInterfaceDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Vehicle", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public interface Vehicle {}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p1", "Car", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public interface Car extends Vehicle {}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p1", "CarImpl", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class CarImpl implements Car {}\n" //$NON-NLS-1$ + ); + + IPath testPath = env.addClass(root, "p1", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Test { public Vehicle createVehicle() { return new CarImpl(); } }\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "Car", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public interface Car {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(testPath); + expectingSpecificProblemFor(testPath, new Problem("Test", "Type mismatch: cannot convert from CarImpl to Vehicle", testPath, 72, 85, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "Car", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public interface Car extends Vehicle {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testMemberTypeDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public class M { public int i; };\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " M m;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C.M m) { return m.i; }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "M cannot be resolved to a type", cPath, 42, 43, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "p3.C.M cannot be resolved to a type", xPath, 38, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public class M { public int i; };\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testMemberTypeVisibility() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public class M { public int i; };\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " M m;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C.M m) { return m.i; }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " class M { public int i; };\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "The type M is not visible", cPath, 42, 43, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The type p3.C.M is not visible", xPath, 38, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " protected class M { public int i; };\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {xPath}); + expectingSpecificProblemFor(xPath, new Problem("X", "The type p3.C.M is not visible", xPath, 38, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public class M { public int i; };\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testMethodDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i(A a) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " int j = i(this);\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath dPath = env.addClass(root, "p3", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class D extends p2.B{\n"+ //$NON-NLS-1$ + " public class M {\n"+ //$NON-NLS-1$ + " int j = i(new D());\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C c) { return c.i(c); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, dPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "The method i(C) is undefined for the type C", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(dPath, new Problem("D", "The method i(D) is undefined for the type D.M", dPath, 69, 70, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The method i(C) is undefined for the type C", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + " public int i(B b) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i(A a) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testMethodVisibility() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i(A a) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{\n"+ //$NON-NLS-1$ + " int j = i(this);\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath dPath = env.addClass(root, "p3", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class D extends p2.B{\n"+ //$NON-NLS-1$ + " public class M {\n"+ //$NON-NLS-1$ + " int j = i(new D());\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath xPath = env.addClass(root, "p4", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p4;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " int foo(p3.C c) { return c.i(c); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " int i(A a) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {cPath, dPath, xPath}); + expectingSpecificProblemFor(cPath, new Problem("C", "The method i(A) from the type A is not visible", cPath, 50, 51, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(dPath, new Problem("D", "The method i(A) from the type A is not visible", dPath, 69, 70, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(xPath, new Problem("X", "The method i(A) from the type A is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + " protected int i(B b) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {xPath}); + expectingSpecificProblemFor(xPath, new Problem("X", "The method i(B) from the type B is not visible", xPath, 57, 58, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public int i(A a) {return 1;};\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class B extends A{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testMissingClassFile() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project1Path,""); //$NON-NLS-1$ + + IPath root1 = env.addPackageFragmentRoot(project1Path, "src"); //$NON-NLS-1$ + env.setOutputFolder(project1Path, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "MissingClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class MissingClass {}" //$NON-NLS-1$ + ); + + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project2Path,""); //$NON-NLS-1$ + + IPath root2 = env.addPackageFragmentRoot(project2Path, "src"); //$NON-NLS-1$ + env.setOutputFolder(project2Path, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "p2", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.MissingClass;\n" + + "public class A {\n"+ //$NON-NLS-1$ + " public void foo(MissingClass data) {}\n"+ //$NON-NLS-1$ + " public void foo(String data) {}\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath project3Path = env.addProject("Project3"); //$NON-NLS-1$ + env.addExternalJars(project3Path, Util.getJavaClassLibs()); + env.addRequiredProject(project3Path, project2Path); + // missing required Project1 so MissingClass cannot be found + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(project3Path,""); //$NON-NLS-1$ + + IPath root3 = env.addPackageFragmentRoot(project3Path, "src"); //$NON-NLS-1$ + env.setOutputFolder(project3Path, "bin"); //$NON-NLS-1$ + + IPath bPath = env.addClass(root3, "p3", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "import p2.A;\n" + + "public class B {\n"+ //$NON-NLS-1$ + " public static void main(String[] args) {\n" + //$NON-NLS-1$ + " new A().foo(new String());\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlyProblemsFor(new IPath[] {project3Path, bPath}); + expectingSpecificProblemFor(project3Path, new Problem("Project3", "The project was not built since its build path is incomplete. Cannot find the class file for p1.MissingClass. Fix the build path then try building this project", project3Path, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(bPath, new Problem("B", "The type p1.MissingClass cannot be resolved. It is indirectly referenced from required .class files", bPath, 86, 111, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root2, "p2", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + " public void foo(String data) {}\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + } + + // 181269 + public void testSecondaryTypeDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A extends Secondary {}\n"+ //$NON-NLS-1$ + "class Secondary {}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + IPath typePath = env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A extends Secondary {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingSpecificProblemFor(typePath, new Problem("A", "Secondary cannot be resolved to a type", typePath, 35, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + // 72468 + public void testTypeDeleting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + IPath bPath = env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class B extends p1.A{}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "class Deleted {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {bPath, cPath}); + expectingSpecificProblemFor(bPath, new Problem("B", "p1.A cannot be resolved to a type", bPath, 35, 39, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(cPath, new Problem("C", "The hierarchy of the type C is inconsistent", cPath, 25, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class B {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + // 72468 + public void testTypeVisibility() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + IPath bPath = env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class B extends p1.A{}\n" //$NON-NLS-1$ + ); + + IPath cPath = env.addClass(root, "p3", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class C extends p2.B{}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "class A {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {bPath, cPath}); + expectingSpecificProblemFor(bPath, new Problem("B", "The type p1.A is not visible", bPath, 35, 39, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(cPath, new Problem("C", "The hierarchy of the type C is inconsistent", cPath, 25, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class B {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class B extends p1.A{}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {bPath, cPath}); + expectingSpecificProblemFor(bPath, new Problem("B", "The type p1.A is not visible", bPath, 35, 39, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(cPath, new Problem("C", "The hierarchy of the type C is inconsistent", cPath, 25, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + // 79163 + public void testTypeVisibility2() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath aPath = env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {\n" + //$NON-NLS-1$ + " void foo() { p2.FooFactory.createFoo().foo(); }\n" + //$NON-NLS-1$ + " void foos() { p2.FooFactory.createFoos().clone(); }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // Foo & Foos are not public to get visibility problems + env.addClass(root, "p2", "Foo", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "class Foo { public void foo() {} }\n" //$NON-NLS-1$ + ); + env.addClass(root, "p2", "Foos", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "class Foos {}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "FooFactory", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class FooFactory {\n" + //$NON-NLS-1$ + " public static Foo createFoo() { return null; }\n" + //$NON-NLS-1$ + " public static Foos[] createFoos() { return null; }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {aPath}); + expectingSpecificProblemFor(aPath, new Problem("A", "The type Foo is not visible", aPath, 43, 68, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "The type Foos is not visible", aPath, 93, 119, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "Foo", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Foo { public void foo() {} }\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {aPath}); + expectingSpecificProblemFor(aPath, new Problem("A", "The type Foos is not visible", aPath, 93, 119, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "Foos", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Foos { }\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p2", "Foo", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "class Foo { public void foo() {} }\n" //$NON-NLS-1$ + ); + env.addClass(root, "p2", "Foos", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "class Foos {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {aPath}); + expectingSpecificProblemFor(aPath, new Problem("A", "The type Foo is not visible", aPath, 43, 68, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "The type Foos is not visible", aPath, 93, 119, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + public void testTypeVariable() throws JavaModelException { + if ((AbstractCompilerTest.getPossibleComplianceLevels() & AbstractCompilerTest.F_1_5) == 0) return; + + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + IPath bPath = env.addClass(root, "p2", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class B extends p1.A {}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + IPath aPath = env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {bPath}); + expectingSpecificProblemFor(bPath, new Problem("B", "The type A is not generic; it cannot be parameterized with arguments ", bPath, 38, 42, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {aPath, bPath}); + expectingSpecificProblemFor(bPath, new Problem("B", "Bound mismatch: The type T is not a valid substitute for the bounded parameter of the type A", bPath, 43, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "Comparable is a raw type. References to generic type Comparable should be parameterized", aPath, 37, 47, CategorizedProblem.CAT_UNCHECKED_RAW, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159709 +// Full build and incremental build behave differently for deprecation +// warnings, which is unexpected. Guard test for DeprecatedTest#test015 (the +// builder is not the cause of the bug, but we want to ensure that the end to +// end behavior is OK). +public void test0100() throws JavaModelException { + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + IPath rootPath = env.getPackageFragmentRootPath(projectPath, ""); + env.addClass(rootPath, "a", "N1", + "package a;\n" + + "public class N1 {\n" + + " public void foo() {}\n" + + " /** @deprecated */\n" + + " public class N2 {" + + " public void foo() {}" + + " public class N3 {" + + " public void foo() {}" + + " }" + + " }" + + " void bar() {}\n" + + "}\n" + ); + String M1Contents = + "package p;\n" + + "public class M1 {\n" + + " public void foo() {}\n" + + " /** @deprecated */\n" + + " public class M2 {" + + " public void foo() {}" + + " public class M3 {" + + " public void foo() {}" + + " }" + + " }" + + " void bar() {\n" + + " a.N1.N2.N3 m = null;\n" + + " m.foo();\n" + + " }\n" + + "}\n"; + IPath M1Path = env.addClass(rootPath, "p", "M1", M1Contents); + fullBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {M1Path}); + expectingSpecificProblemFor(M1Path, + new Problem("", "The type N1.N2.N3 is deprecated", + M1Path, 198, 200, CategorizedProblem.CAT_DEPRECATION, IMarker.SEVERITY_WARNING)); + expectingSpecificProblemFor(M1Path, + new Problem("", "The method foo() from the type N1.N2.N3 is deprecated", + M1Path, 217, 222, CategorizedProblem.CAT_DEPRECATION, IMarker.SEVERITY_WARNING)); + M1Path = env.addClass(rootPath, "p", "M1", M1Contents); + incrementalBuild(projectPath); + expectingOnlyProblemsFor(new IPath[] {M1Path}); + expectingSpecificProblemFor(M1Path, + new Problem("", "The type N1.N2.N3 is deprecated", + M1Path, 198, 200, CategorizedProblem.CAT_DEPRECATION, IMarker.SEVERITY_WARNING)); + expectingSpecificProblemFor(M1Path, + new Problem("", "The method foo() from the type N1.N2.N3 is deprecated", + M1Path, 217, 222, CategorizedProblem.CAT_DEPRECATION, IMarker.SEVERITY_WARNING)); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java new file mode 100644 index 0000000000..1a7db581b9 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyCompilerRequestor.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * 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.builder; + +import java.util.ArrayList; +import org.eclipse.jdt.internal.compiler.ClassFile; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.IDebugRequestor; +import org.eclipse.jdt.internal.core.util.Util; + +public class EfficiencyCompilerRequestor implements IDebugRequestor { + private boolean isActive = false; + + private ArrayList compiledClasses = new ArrayList<>(); + private ArrayList compiledFiles = new ArrayList<>(); + private ArrayList classes = new ArrayList<>(); + + + public void acceptDebugResult(CompilationResult result){ + this.compiledFiles.add(new String(result.fileName)); + ClassFile[] classFiles = result.getClassFiles(); + Util.sort(classFiles, new Util.Comparer() { + public int compare(Object a, Object b) { + String aName = new String(((ClassFile)a).fileName()); + String bName = new String(((ClassFile)b).fileName()); + return aName.compareTo(bName); + } + }); + for (int i = 0; i < classFiles.length; i++) { + ClassFile c = classFiles[i]; + this.classes.add(c); + String className = new String(c.fileName()); + this.compiledClasses.add(className.replace('/', '.')); + } + } + + String[] getCompiledClasses(){ + return this.compiledClasses.toArray(new String[this.compiledClasses.size()]); + } + + String[] getCompiledFiles(){ + return this.compiledFiles.toArray(new String[this.compiledFiles.size()]); + } + public ClassFile[] getClassFiles() { + return this.classes.toArray(new ClassFile[this.classes.size()]); + } + + public void clearResult(){ + this.compiledClasses.clear(); + this.compiledFiles.clear(); + this.classes.clear(); + } + + public void reset() { + // do nothing by default + } + + public void activate() { + this.isActive = true; + } + + public void deactivate() { + this.isActive = false; + } + + public boolean isActive() { + return this.isActive; + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java new file mode 100644 index 0000000000..02237c6eae --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/EfficiencyTests.java @@ -0,0 +1,415 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.builder; + +import junit.framework.*; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +/** + * Basic efficiency tests of the image builder. + */ +public class EfficiencyTests extends BuilderTests { + public EfficiencyTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(EfficiencyTests.class); + } + + public void testProjectAsClassFolder() throws JavaModelException { + IPath projectPath1 = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(projectPath1, Util.getJavaClassLibs()); + + IPath projectPath2 = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + env.addClassFolder(projectPath2, projectPath1, false); + + env.addClass(projectPath2, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class X {}\n" //$NON-NLS-1$ + ); + + env.addClass(projectPath2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {}\n" //$NON-NLS-1$ + ); + + fullBuild(); + + env.addClass(projectPath2, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath2); + + // if a full build happens instead of an incremental, then both types will be recompiled + expectingCompiledClasses(new String[]{"p1.X"}); //$NON-NLS-1$ + } + + public void testEfficiency() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Indicted", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class Indicted {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "Collaborator", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Collaborator extends Indicted{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + + env.addClass(root, "p1", "Indicted", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class Indicted {\n"+ //$NON-NLS-1$ + " public abstract void foo();\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p2.Collaborator", "p1.Indicted"}); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/Indicted.java", "/Project/src/p2/Collaborator.java" }); + } + + public void testMethodAddition() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Y extends X{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Z{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void bar(){} \n" + //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p1.X", "p2.Y"}); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java", "/Project/src/p2/Y.java" }); + } + + public void testLocalTypeAddition() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Y extends X{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Z{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " new Object(){ \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p1.X", "p1.X$1"}); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); + } + + public void testLocalTypeAddition2() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " new X(){ \n" + //$NON-NLS-1$ + " void bar(){} \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Y extends X{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Z{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " new Object(){ \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " new X(){ \n" + //$NON-NLS-1$ + " void bar(){} \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p1.X", "p1.X$1", "p1.X$2"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); + } + + public void testLocalTypeRemoval() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " new Object(){ \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Y extends X{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Z{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p1.X"}); //$NON-NLS-1$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); + } + + public void testLocalTypeRemoval2() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " new Object(){ \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " new X(){ \n" + //$NON-NLS-1$ + " void bar(){} \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Y extends X{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Z{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " new X(){ \n" + //$NON-NLS-1$ + " void bar(){} \n" + //$NON-NLS-1$ + " }; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p1.X", "p1.X$1"}); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder(new String[] { "/Project/src/p1/X.java" }); + } + // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation + public void testMissingType001() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo(p2.Y y) { \n" + //$NON-NLS-1$ + " y.bar(null);" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " public void bar(Z z) {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + fullBuild(projectPath); + + env.addClass(root, "p2", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingCompiledClasses(new String[]{"p1.X", "p2.Y","p2.Z"}); //$NON-NLS-1$ //$NON-NLS-2$ + expectingCompilingOrder( + new String[] { "/Project/src/p2/Z.java", "/Project/src/p2/Y.java", "/Project/src/p1/X.java" }); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java new file mode 100644 index 0000000000..6d698defc8 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ErrorsTests.java @@ -0,0 +1,648 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Hashtable; + +import junit.framework.Test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IClasspathAttribute; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IRegion; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.ToolFactory; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.core.util.IClassFileReader; +import org.eclipse.jdt.core.util.IMethodInfo; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; +import org.eclipse.jdt.internal.core.builder.JavaBuilder; + + +/** + * Basic errors tests of the image builder. + */ +@SuppressWarnings({"rawtypes", "unchecked"}) +public class ErrorsTests extends BuilderTests { + private static final IClasspathAttribute ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE = JavaCore.newClasspathAttribute(IClasspathAttribute.IGNORE_OPTIONAL_PROBLEMS, "true"); + + private static final Comparator COMPARATOR = new Comparator() { + public int compare(Object o1, Object o2) { + IResource resource1 = (IResource) o1; + IResource resource2 = (IResource) o2; + String path1 = resource1.getFullPath().toString(); + String path2 = resource2.getFullPath().toString(); + int length1 = path1.length(); + int length2 = path2.length(); + + if (length1 != length2) { + return length1 - length2; + } + return path1.toString().compareTo(path2.toString()); + } + }; + + public ErrorsTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(ErrorsTests.class); + } + + public void testErrors() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Indicted", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class Indicted {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + IPath collaboratorPath = env.addClass(root, "p2", "Collaborator", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.*;\n"+ //$NON-NLS-1$ + "public class Collaborator extends Indicted{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p1", "Indicted", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public abstract class Indicted {\n"+ //$NON-NLS-1$ + " public abstract void foo();\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingOnlyProblemsFor(collaboratorPath); + expectingOnlySpecificProblemFor(collaboratorPath, new Problem("Collaborator", "The type Collaborator must implement the inherited abstract method Indicted.foo()", collaboratorPath, 38, 50, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /* + * Regression test for bug 2857 Renaming .java class with errors to .txt leaves errors in Task list (1GK06R3) + */ + public void testRenameToNonJava() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath,""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath cuPath = env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X extends Y {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(projectPath); + expectingOnlyProblemsFor(cuPath); + expectingOnlySpecificProblemFor(cuPath, new Problem("X", "Y cannot be resolved to a type", cuPath, 35, 36, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + + env.renameCU(root.append("p1"), "X.java", "X.txt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + incrementalBuild(projectPath); + expectingNoProblems(); + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test0100() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + IPath classTest1 = env.addClass(root, "p1", "Test1", + "package p1;\n" + + "public class Test1 extends Test2 {}" + ); + fullBuild(); + Problem[] prob1 = env.getProblemsFor(classTest1); + expectingSpecificProblemFor(classTest1, new Problem("p1", "Test2 cannot be resolved to a type", classTest1, 39, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); + assertEquals(JavaBuilder.SOURCE_ID, prob1[0].getSourceId()); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test0101() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + IPath classTest1 = env.addClass(root, "p1", "Test1", + "package p1;\n" + + "public class Test1 extends {}" + ); + fullBuild(); + Problem[] prob1 = env.getProblemsFor(classTest1); + expectingSpecificProblemFor(classTest1, new Problem("p1", "Syntax error on token \"extends\", Type expected after this token", classTest1, 31, 38, CategorizedProblem.CAT_SYNTAX, IMarker.SEVERITY_ERROR)); + assertEquals(JavaBuilder.SOURCE_ID, prob1[0].getSourceId()); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test0102() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + IPath classTest1 = env.addClass(root, "p1", "Test1", + "package p1;\n" + + "public class Test1 {\n" + + " private static int i;\n" + + " int j = i;\n" + + "}\n" + + "class Test2 {\n" + + " static int i = Test1.i;\n" + + "}\n" + ); + fullBuild(); + Problem[] prob1 = env.getProblemsFor(classTest1); + expectingSpecificProblemFor(classTest1, new Problem("p1", "The field Test1.i is not visible", classTest1, 109, 110, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); + assertEquals(JavaBuilder.SOURCE_ID, prob1[0].getSourceId()); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test0103() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + IPath classTest1 = env.addClass(root, "p1", "Test1", + "package p1;\n" + + "public class Test1 {\n" + + " // TODO: marker only\n" + + "}\n" + ); + fullBuild(); + Problem[] prob1 = env.getProblemsFor(classTest1); + expectingSpecificProblemFor(classTest1, new Problem("p1", "TODO: marker only", classTest1, 38, 55, -1, IMarker.SEVERITY_ERROR)); + assertEquals(JavaBuilder.SOURCE_ID, prob1[0].getSourceId()); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test0104() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + IPath classTest1 = env.addClass(root, "p1", "Test1", + "package p1;\n" + + "public class Test1 {}" + ); + fullBuild(); + Problem[] prob1 = env.getProblemsFor(classTest1); + expectingSpecificProblemFor(classTest1, + new Problem("p1", "The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files", classTest1, 0, 1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); + assertEquals(JavaBuilder.SOURCE_ID, prob1[0].getSourceId()); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=97998 +// Improving the error message in case of a read-only file in output +// directory. Beware: this test only works under Linux - execution on other +// platforms always succeeds, but the result is not significant. +public void _test0105() throws JavaModelException, CoreException, IOException { // FIXME: re-enable! + if ("Linux".equals(System.getProperty("os.name"))) { + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + IPath root = env.getPackageFragmentRootPath(projectPath, ""); + IPath outputFolderPath = env.getOutputLocation(projectPath); + File outputFolder = env.getWorkspaceRootPath().append(outputFolderPath).toFile(); + env.addClass(root, "p1", + "X", + "package p1;\n" + + "public class X {\n" + + "}\n" + ); + try { + fullBuild(projectPath); + expectingNoProblems(); + outputFolder.setReadOnly(); + // outputFolder.setReadable(false); + // PREMATURE no appropriate solution for Windows/NTFS/JDK 1.4 + System.err.println("\n\n=== EXPECTED EXCEPTION ========================================================="); + System.err.println("ErrorsTests#test0105 will emit an expected exception below"); + cleanBuild(); + System.err.println("=== END OF EXPECTED EXCEPTION ==================================================\n\n"); + expectingOnlySpecificProblemFor(env.getWorkspaceRootPath(), + new Problem("", + "The project was not built due to \"Could not delete \'" + + env.getWorkspaceRootPath() + "/P/bin/.classpath\'.\". " + + "Fix the problem, then try refreshing this project and building " + + "it since it may be inconsistent", projectPath, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)); + } finally { + // waiting for JDK 6: outputFolder.setWritable(true); -- workaround: + Process process = null; + try { + process = Runtime.getRuntime().exec("chmod -R a+w " + outputFolder.getAbsolutePath()); + process.waitFor(); + } catch (InterruptedException e) { + // go ahead + } finally { + if (process != null) { + process.destroy(); + } + } + } + try { + cleanBuild(); + expectingNoProblems(); + } catch (Throwable t) { + Process process = null; + try { + process = Runtime.getRuntime().exec("chmod -R a+w " + outputFolder.getAbsolutePath()); + process.waitFor(); + } catch (InterruptedException ie) { + // go ahead + } finally { + if (process != null) { + process.destroy(); + } + } + fail(t.getMessage()); + } + } +} + +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=224715 +public void test0106() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src", null, null); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath classTest1 = env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X implements I {\n" + + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p1", "I", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public interface I {\n" + + " public void foo() {\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingSpecificProblemFor(classTest1, new Problem("p1", "The type X must implement the inherited abstract method I.foo()", classTest1, 25, 26, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); + + IJavaProject project = env.getJavaProject(projectPath); + IRegion region = JavaCore.newRegion(); + region.add(project); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/I.class\n" + + "/Project/bin/p1/X.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + assertEquals("Wrong type", IResource.FILE, resources[1].getType()); + IFile classFile = (IFile) resources[1]; + IClassFileReader classFileReader = null; + InputStream stream = null; + try { + stream = classFile.getContents(); + classFileReader = ToolFactory.createDefaultClassFileReader(stream, IClassFileReader.ALL); + } catch (CoreException e) { + e.printStackTrace(); + } finally { + if (stream != null) { + try { + stream.close(); + } catch(IOException e) { + // ignore + } + } + } + assertNotNull("No class file reader", classFileReader); + IMethodInfo[] methodInfos = classFileReader.getMethodInfos(); + IMethodInfo found = null; + loop: for (int i = 0, max = methodInfos.length; i < max; i++) { + IMethodInfo methodInfo = methodInfos[i]; + if (CharOperation.equals(methodInfo.getName(), "foo".toCharArray())) { + found = methodInfo; + break loop; + } + } + assertNotNull("No method found", found); + assertTrue("Not a synthetic method", found.isSynthetic()); + env.removeProject(projectPath); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=225563 +public void test0107() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src", null, null); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath classTest1 = env.addClass(root, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C implements None {\n" + + " public String toString(Arg a) {\n" + + " return null;\n" + + " }\n" + + " public String toString(Arg[] a) {\n" + + " return null;\n" + + " }\n" + + "}" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + expectingOnlySpecificProblemsFor(classTest1, new Problem[] { + new Problem("", "None cannot be resolved to a type", classTest1, 26, 30, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR), + new Problem("", "Arg cannot be resolved to a type", classTest1, 64, 67, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR), + new Problem("", "Arg cannot be resolved to a type", classTest1, 143, 146, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR) + }); + + IJavaProject project = env.getJavaProject(projectPath); + IRegion region = JavaCore.newRegion(); + region.add(project); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 1, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/C.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + assertEquals("Wrong type", IResource.FILE, resources[0].getType()); + IFile classFile = (IFile) resources[0]; + InputStream stream = null; + try { + stream = classFile.getContents(); + ClassFileReader.read(stream, "C.java"); + } catch (Exception e) { + e.printStackTrace(); + assertTrue("Should not happen", false); + } finally { + if (stream != null) { + try { + stream.close(); + } catch(IOException e) { + // ignore + } + } + } +} +private String getResourceOuput(IResource[] resources) { + StringWriter stringWriter = new StringWriter(); + PrintWriter writer = new PrintWriter(stringWriter); + for (int i = 0, max = resources.length; i < max; i++) { + writer.println(resources[i].getFullPath().toString()); + } + writer.flush(); + writer.close(); + return Util.convertToIndependantLineDelimiter(String.valueOf(stringWriter)); +} + +// ignore optional errors +public void test0108() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + env.setOutputFolder(projectPath, "bin"); + IPath root = new Path("/P/src"); + env.addEntry(projectPath, JavaCore.newSourceEntry(root, null, null, + null, new IClasspathAttribute[] { ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE })); + + env.addClass(root, "p", "X", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + "}"); + + fullBuild(projectPath); + expectingNoProblems(); + + JavaCore.setOptions(options); +} + +// two different source folders ignore only from one +public void test0109() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + env.setOutputFolder(projectPath, "bin"); + IPath src = new Path("/P/src"); + IPath src2 = new Path("/P/src2"); + env.addEntry(projectPath, JavaCore.newSourceEntry(src, null, null, + null, new IClasspathAttribute[] { ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE })); + env.addEntry(projectPath, JavaCore.newSourceEntry(src2)); + + env.addClass(src, "p", "X", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + "}"); + + IPath classY = env.addClass(src2, "q", "Y", + "package q;\n" + + "public class Y {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + "}"); + + fullBuild(projectPath); + expectingNoProblemsFor(src); + expectingOnlySpecificProblemFor(classY, new Problem("q", "The value of the local variable i is not used", classY, 55, 56, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_ERROR)); + + JavaCore.setOptions(options); +} + +// two different source folders ignore from both +public void test0110() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + env.setOutputFolder(projectPath, "bin"); + IPath src = new Path("/P/src"); + IPath src2 = new Path("/P/src2"); + env.addEntry(projectPath, JavaCore.newSourceEntry(src, null, null, + null, new IClasspathAttribute[] { ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE })); + env.addEntry(projectPath, JavaCore.newSourceEntry(src2, null, null, + null, new IClasspathAttribute[] { ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE })); + + env.addClass(src, "p", "X", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + "}"); + + env.addClass(src2, "q", "Y", + "package q;\n" + + "public class Y {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + "}"); + + fullBuild(projectPath); + expectingNoProblems(); + + JavaCore.setOptions(options); +} + +//non-optional errors cannot be ignored +public void test0111() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + env.setOutputFolder(projectPath, "bin"); + IPath root = new Path("/P/src"); + env.addEntry(projectPath, JavaCore.newSourceEntry(root, null, null, + null, new IClasspathAttribute[] { ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE })); + + IPath classX = env.addClass(root, "p", "X", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + " public void bar() {\n" + + " a++;\n" + + " }\n" + + "}"); + + fullBuild(projectPath); + expectingOnlySpecificProblemFor(classX, new Problem("p", "a cannot be resolved to a variable", classX, 84, 85, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); + + JavaCore.setOptions(options); +} + +//task tags cannot be ignored +public void test0112() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.ERROR); + newOptions.put(JavaCore.COMPILER_TASK_TAGS, "TODO"); + newOptions.put(JavaCore.COMPILER_TASK_PRIORITIES, "NORMAL"); + + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("P"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + env.setOutputFolder(projectPath, "bin"); + IPath root = new Path("/P/src"); + env.addEntry(projectPath, JavaCore.newSourceEntry(root, null, null, + null, new IClasspathAttribute[] { ATTR_IGNORE_OPTIONAL_PROBLEMS_TRUE })); + + IPath classX = env.addClass(root, "p", "X", + "package p;\n" + + "public class X {\n" + + " public void foo() {\n" + + " int i;\n" + + " }\n" + + " public void bar() {\n" + + " // TODO nothing\n" + + " }\n" + + "}"); + + fullBuild(projectPath); + expectingOnlySpecificProblemFor(classX, new Problem("p", "TODO nothing", classX, 87, 99, -1, IMarker.SEVERITY_ERROR)); + + JavaCore.setOptions(options); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java new file mode 100644 index 0000000000..0cc33c5ca5 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ExecutionTests.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.builder; + +import junit.framework.*; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +/** + * Basic execution tests of the image builder. + */ +public class ExecutionTests extends BuilderTests { + public ExecutionTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(ExecutionTests.class); + } + + public void testSuccess() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.print(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + executeClass(projectPath, "p1.Hello", "Hello world", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testFailure() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath helloPath = env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\")\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + // public static void main(String args[]) { + // System.out.println("Hello world") <-- missing ";" + // } + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(helloPath); + executeClass(projectPath, "p1.Hello", "", //$NON-NLS-1$ //$NON-NLS-2$ + "java.lang.Error: Unresolved compilation problem: \n" + //$NON-NLS-1$ + " Syntax error, insert \";\" to complete BlockStatements\n" //$NON-NLS-1$ + ); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FriendDependencyTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FriendDependencyTests.java new file mode 100644 index 0000000000..0f8cdc472a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/FriendDependencyTests.java @@ -0,0 +1,325 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import junit.framework.Test; + +import java.util.Map; + +import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; +import org.eclipse.jdt.internal.core.JavaModelManager; +import org.eclipse.jdt.internal.core.builder.ReferenceCollection; +import org.eclipse.jdt.internal.core.builder.State; +import org.eclipse.jdt.internal.core.builder.StringSet; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class FriendDependencyTests extends BuilderTests { + + public FriendDependencyTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(FriendDependencyTests.class); + } +// this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testIncludes() { + try { + State state = (State) JavaModelManager.getJavaModelManager().getLastBuiltState(null, null); + Map references = state.getReferences(); + ReferenceCollection r = references.values().iterator().next(); + char[][][] qualifiedNames = null; + char[][] simpleNames = null; + char[][] rootNames = null; + r.includes(qualifiedNames, simpleNames, rootNames); + } catch (NullPointerException e) { + // expected + } +} + +// this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testInternSimpleNames() { + ReferenceCollection.internSimpleNames(new StringSet(1), true); + + try { + String className = "org.eclipse.jdt.internal.core.builder.ReferenceCollection"; + Class clazz = Class.forName(className); + //org.eclipse.jdt.internal.core.JavaModelManager.getLastBuiltState(IProject, IProgressMonitor) + Class[] arguments = new Class[2]; + String argumentClassName = "org.eclipse.jdt.internal.core.builder.StringSet"; + arguments[0] = Class.forName(argumentClassName); + arguments[1] = Boolean.TYPE; + clazz.getDeclaredMethod("internSimpleNames", arguments); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} + +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testInternQualifiedNames() { + ReferenceCollection.internQualifiedNames(new StringSet(1)); + + try { + String className = "org.eclipse.jdt.internal.core.builder.ReferenceCollection"; + Class clazz = Class.forName(className); + //org.eclipse.jdt.internal.core.JavaModelManager.getLastBuiltState(IProject, IProgressMonitor) + Class[] arguments = new Class[1]; + String argumentClassName = "org.eclipse.jdt.internal.core.builder.StringSet"; + arguments[0] = Class.forName(argumentClassName); + clazz.getDeclaredMethod("internQualifiedNames", arguments); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testGetReferences() { + try { + State state = (State) JavaModelManager.getJavaModelManager().getLastBuiltState(null, null); + state.getReferences(); + } catch (NullPointerException e) { + // expected + } + try { + String className = "org.eclipse.jdt.internal.core.builder.State"; + Class clazz = Class.forName(className); + clazz.getDeclaredMethod("getReferences", new Class[0]); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testStringSetAdd() { + StringSet s = new StringSet(3); + s.add(""); + + try { + String className = "org.eclipse.jdt.internal.core.builder.StringSet"; + Class clazz = Class.forName(className); + Class[] arguments = new Class[1]; + String argumentClassName = "java.lang.String"; + arguments[0] = Class.forName(argumentClassName); + clazz.getDeclaredMethod("add", arguments); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testStringSetclear() { + StringSet s = new StringSet(3); + s.clear(); + + try { + String className = "org.eclipse.jdt.internal.core.builder.StringSet"; + Class clazz = Class.forName(className); + clazz.getDeclaredMethod("clear", new Class[0]); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testStringSetNew() { + new StringSet(3); + + try { + String className = "org.eclipse.jdt.internal.core.builder.StringSet"; + Class clazz = Class.forName(className); + Class[] arguments = new Class[1]; + arguments[0] = Integer.TYPE; + clazz.getDeclaredConstructor(arguments); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this field still exists since API Tooling is using it +public void testStringSetElementSize() { + StringSet s = new StringSet(3); + assertEquals("Not expected", 0, s.elementSize); + + try { + String className = "org.eclipse.jdt.internal.core.builder.StringSet"; + Class clazz = Class.forName(className); + clazz.getDeclaredField("elementSize"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this field still exists since API Tooling is using it +public void testSimpleLookupTableKeyTable() { + SimpleLookupTable t = new SimpleLookupTable(3); + assertNotNull("Null", t.keyTable); + + try { + String className = "org.eclipse.jdt.internal.compiler.util.SimpleLookupTable"; + Class clazz = Class.forName(className); + clazz.getDeclaredField("keyTable"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this field still exists since API Tooling is using it +public void testSimpleLookupTableValueTable() { + SimpleLookupTable t = new SimpleLookupTable(3); + assertNotNull("Null", t.valueTable); + + try { + String className = "org.eclipse.jdt.internal.compiler.util.SimpleLookupTable"; + Class clazz = Class.forName(className); + clazz.getDeclaredField("valueTable"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testJavaModelManagerGetJavaModelManager() { + JavaModelManager.getJavaModelManager(); + try { + String className = "org.eclipse.jdt.internal.core.JavaModelManager"; + Class clazz = Class.forName(className); + clazz.getDeclaredMethod("getJavaModelManager", new Class[0]); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +//this is a compilation only test to verify that this method still exists since API Tooling is using it +public void testJavaModelManagerGetLastBuiltState() { + try { + JavaModelManager.getJavaModelManager().getLastBuiltState(null, null); + } catch (NullPointerException e) { + // expected + } + try { + String className = "org.eclipse.jdt.internal.core.JavaModelManager"; + Class clazz = Class.forName(className); + //org.eclipse.jdt.internal.core.JavaModelManager.getLastBuiltState(IProject, IProgressMonitor) + Class[] arguments = new Class[2]; + String argumentClassName = "org.eclipse.core.resources.IProject"; + String argumentClassName2 = "org.eclipse.core.runtime.IProgressMonitor"; + arguments[0] = Class.forName(argumentClassName); + arguments[1] = Class.forName(argumentClassName2); + clazz.getDeclaredMethod("getLastBuiltState", arguments); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (SecurityException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (NoSuchMethodException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + assertTrue("Should be there", false); + } +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/GetResourcesTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/GetResourcesTests.java new file mode 100644 index 0000000000..9ddf18f728 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/GetResourcesTests.java @@ -0,0 +1,1018 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; +import java.util.Comparator; + +import junit.framework.Test; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.ICompilationUnit; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.IPackageFragment; +import org.eclipse.jdt.core.IPackageFragmentRoot; +import org.eclipse.jdt.core.IRegion; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +/** + * Basic tests of {@link JavaCore#getGeneratedResources(IRegion, boolean)}. + */ +@SuppressWarnings({"rawtypes", "unchecked"}) +public class GetResourcesTests extends BuilderTests { + + private static final Comparator COMPARATOR = new Comparator() { + public int compare(Object o1, Object o2) { + IResource resource1 = (IResource) o1; + IResource resource2 = (IResource) o2; + String path1 = resource1.getFullPath().toString(); + String path2 = resource2.getFullPath().toString(); + int length1 = path1.length(); + int length2 = path2.length(); + + if (length1 != length2) { + return length1 - length2; + } + return path1.toString().compareTo(path2.toString()); + } + }; + + public GetResourcesTests(String name) { + super(name); + } + + static { +// TESTS_NUMBERS = new int[] { 15 }; + } + + public static Test suite() { + return buildTestSuite(GetResourcesTests.class); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test001() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Hello.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 1, resources.length);//$NON-NLS-1$ + String actualOutput = getResourceOuput(resources); + String expectedOutput = "/Project/bin/p1/Hello.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test002() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " Object foo() {\n" + //$NON-NLS-1$ + " return new Object() {};\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Hello.java");//$NON-NLS-1$ + + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$1.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test003() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " Object foo() {\n" + + " if(false) {\n" + //$NON-NLS-1$ + " return new Object() {};\n" + + " }\n" + + " return null;\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Hello.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 1, resources.length);//$NON-NLS-1$ + String actualOutput = getResourceOuput(resources); + String expectedOutput = "/Project/bin/p1/Hello.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test004() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " Object foo() {\n" + + " return new Object() {};\n" + + " }\n" + //$NON-NLS-1$ + " Object foo2() {\n" + + " return new Object() {};\n" + + " }\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Hello.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 3, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$1.class\n" + + "/Project/bin/p1/Hello$2.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test005() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "a", "Anon", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "\n" + + "public class Anon {\n" + + "\n" + + " Anon() {\n" + + " Object o1 = new Object() {\n" + + " public String toString() {\n" + + " return \"1\"; // a/Anon$3 in 1.5, a/Anon$11 in 1.4\n" + + " }\n" + + " };\n" + + " Object o2 = new Object() {\n" + + " public String toString() {\n" + + " return \"2\"; // a/Anon$4 in 1.5, a/Anon$12 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " void hello() {\n" + + " Object o3 = new Object() {\n" + + " public String toString() {\n" + + " return \"3\"; // a/Anon$5 in 1.5, a/Anon$13 in 1.4\n" + + " }\n" + + " };\n" + + " Object o4 = new Object() {\n" + + " public String toString() {\n" + + " return \"4\"; // a/Anon$6 in 1.5, a/Anon$14 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static void hello2() {\n" + + " Object o5 = new Object() {\n" + + " public String toString() {\n" + + " return \"5\"; // a/Anon$7 in 1.5, a/Anon$15 in 1.4\n" + + " }\n" + + " };\n" + + " Object o6 = new Object() {\n" + + " public String toString() {\n" + + " return \"6\"; // a/Anon$8 in 1.5, a/Anon$16 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static {\n" + + " Object o7 = new Object() {\n" + + " public String toString() {\n" + + " return \"7\"; // a/Anon$1 in 1.5, a/Anon$1 in 1.4\n" + + " }\n" + + " };\n" + + "\n" + + " Object o8 = new Object() {\n" + + " public String toString() {\n" + + " return \"8\"; // a/Anon$2 in 1.5, a/Anon$2 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static class Anon2 {\n" + + " // it\'s an object init block which has different prio as constructor!\n" + + " {\n" + + " Object o1 = new Object() {\n" + + " public String toString() {\n" + + " return \"1\"; // a/Anon$Anon2$1 in 1.5, a/Anon$3 in 1.4\n" + + " }\n" + + " };\n" + + " Object o2 = new Object() {\n" + + " public String toString() {\n" + + " return \"2\"; // a/Anon$Anon2$2 in 1.5, a/Anon$4 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " void hello() {\n" + + " Object o3 = new Object() {\n" + + " public String toString() {\n" + + " return \"3\"; // a/Anon$Anon2$5 in 1.5, a/Anon$7 in 1.4\n" + + " }\n" + + " };\n" + + " Object o4 = new Object() {\n" + + " public String toString() {\n" + + " return \"4\"; // a/Anon$Anon2$6 in 1.5, a/Anon$8 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static void hello2() {\n" + + " Object o5 = new Object() {\n" + + " public String toString() {\n" + + " return \"5\"; // a/Anon$Anon2$7 in 1.5, a/Anon$9 in 1.4\n" + + " }\n" + + " };\n" + + " Object o6 = new Object() {\n" + + " public String toString() {\n" + + " return \"6\"; // a/Anon$Anon2$8 in 1.5, a/Anon$10 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static {\n" + + " Object o7 = new Object() {\n" + + " public String toString() {\n" + + " return \"7\"; // a/Anon$Anon2$3 in 1.5, a/Anon$5 in 1.4\n" + + " }\n" + + " };\n" + + "\n" + + " Object o8 = new Object() {\n" + + " public String toString() {\n" + + " return \"8\"; // a/Anon$Anon2$4 in 1.5, a/Anon$6 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + " }\n" + + "}"); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("a");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Anon.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 18, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/a/Anon.class\n" + + "/Project/bin/a/Anon$1.class\n" + + "/Project/bin/a/Anon$2.class\n" + + "/Project/bin/a/Anon$3.class\n" + + "/Project/bin/a/Anon$4.class\n" + + "/Project/bin/a/Anon$5.class\n" + + "/Project/bin/a/Anon$6.class\n" + + "/Project/bin/a/Anon$7.class\n" + + "/Project/bin/a/Anon$8.class\n" + + "/Project/bin/a/Anon$9.class\n" + + "/Project/bin/a/Anon$10.class\n" + + "/Project/bin/a/Anon$11.class\n" + + "/Project/bin/a/Anon$12.class\n" + + "/Project/bin/a/Anon$13.class\n" + + "/Project/bin/a/Anon$14.class\n" + + "/Project/bin/a/Anon$15.class\n" + + "/Project/bin/a/Anon$16.class\n" + + "/Project/bin/a/Anon$Anon2.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test006() throws JavaModelException { + IPath projectPath = null; + try { + projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + } catch (RuntimeException e) { + // no 1.5 VM or above is available + return; + } + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "a", "Anon", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "\n" + + "public class Anon {\n" + + "\n" + + " Anon() {\n" + + " Object o1 = new Object() {\n" + + " public String toString() {\n" + + " return \"1\"; // a/Anon$3 in 1.5, a/Anon$11 in 1.4\n" + + " }\n" + + " };\n" + + " Object o2 = new Object() {\n" + + " public String toString() {\n" + + " return \"2\"; // a/Anon$4 in 1.5, a/Anon$12 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " void hello() {\n" + + " Object o3 = new Object() {\n" + + " public String toString() {\n" + + " return \"3\"; // a/Anon$5 in 1.5, a/Anon$13 in 1.4\n" + + " }\n" + + " };\n" + + " Object o4 = new Object() {\n" + + " public String toString() {\n" + + " return \"4\"; // a/Anon$6 in 1.5, a/Anon$14 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static void hello2() {\n" + + " Object o5 = new Object() {\n" + + " public String toString() {\n" + + " return \"5\"; // a/Anon$7 in 1.5, a/Anon$15 in 1.4\n" + + " }\n" + + " };\n" + + " Object o6 = new Object() {\n" + + " public String toString() {\n" + + " return \"6\"; // a/Anon$8 in 1.5, a/Anon$16 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static {\n" + + " Object o7 = new Object() {\n" + + " public String toString() {\n" + + " return \"7\"; // a/Anon$1 in 1.5, a/Anon$1 in 1.4\n" + + " }\n" + + " };\n" + + "\n" + + " Object o8 = new Object() {\n" + + " public String toString() {\n" + + " return \"8\"; // a/Anon$2 in 1.5, a/Anon$2 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static class Anon2 {\n" + + " // it\'s an object init block which has different prio as constructor!\n" + + " {\n" + + " Object o1 = new Object() {\n" + + " public String toString() {\n" + + " return \"1\"; // a/Anon$Anon2$1 in 1.5, a/Anon$3 in 1.4\n" + + " }\n" + + " };\n" + + " Object o2 = new Object() {\n" + + " public String toString() {\n" + + " return \"2\"; // a/Anon$Anon2$2 in 1.5, a/Anon$4 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " void hello() {\n" + + " Object o3 = new Object() {\n" + + " public String toString() {\n" + + " return \"3\"; // a/Anon$Anon2$5 in 1.5, a/Anon$7 in 1.4\n" + + " }\n" + + " };\n" + + " Object o4 = new Object() {\n" + + " public String toString() {\n" + + " return \"4\"; // a/Anon$Anon2$6 in 1.5, a/Anon$8 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static void hello2() {\n" + + " Object o5 = new Object() {\n" + + " public String toString() {\n" + + " return \"5\"; // a/Anon$Anon2$7 in 1.5, a/Anon$9 in 1.4\n" + + " }\n" + + " };\n" + + " Object o6 = new Object() {\n" + + " public String toString() {\n" + + " return \"6\"; // a/Anon$Anon2$8 in 1.5, a/Anon$10 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " static {\n" + + " Object o7 = new Object() {\n" + + " public String toString() {\n" + + " return \"7\"; // a/Anon$Anon2$3 in 1.5, a/Anon$5 in 1.4\n" + + " }\n" + + " };\n" + + "\n" + + " Object o8 = new Object() {\n" + + " public String toString() {\n" + + " return \"8\"; // a/Anon$Anon2$4 in 1.5, a/Anon$6 in 1.4\n" + + " }\n" + + " };\n" + + " }\n" + + " }\n" + + "}"); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("a");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Anon.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 18, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/a/Anon.class\n" + + "/Project/bin/a/Anon$1.class\n" + + "/Project/bin/a/Anon$2.class\n" + + "/Project/bin/a/Anon$3.class\n" + + "/Project/bin/a/Anon$4.class\n" + + "/Project/bin/a/Anon$5.class\n" + + "/Project/bin/a/Anon$6.class\n" + + "/Project/bin/a/Anon$7.class\n" + + "/Project/bin/a/Anon$8.class\n" + + "/Project/bin/a/Anon$Anon2.class\n" + + "/Project/bin/a/Anon$Anon2$1.class\n" + + "/Project/bin/a/Anon$Anon2$2.class\n" + + "/Project/bin/a/Anon$Anon2$3.class\n" + + "/Project/bin/a/Anon$Anon2$4.class\n" + + "/Project/bin/a/Anon$Anon2$5.class\n" + + "/Project/bin/a/Anon$Anon2$6.class\n" + + "/Project/bin/a/Anon$Anon2$7.class\n" + + "/Project/bin/a/Anon$Anon2$8.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + private String getResourceOuput(IResource[] resources) { + StringWriter stringWriter = new StringWriter(); + PrintWriter writer = new PrintWriter(stringWriter); + for (int i = 0, max = resources.length; i < max; i++) { + writer.println(resources[i].getFullPath().toString()); + } + writer.flush(); + writer.close(); + return Util.convertToIndependantLineDelimiter(String.valueOf(stringWriter)); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test007() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" + //$NON-NLS-1$ + "class Foo {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Hello.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test008() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(packageFragment); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test009() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(projectPath, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getUnderlyingResource()); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + ICompilationUnit compilationUnit = packageFragment.getCompilationUnit("Hello.java");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(compilationUnit); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 1, resources.length);//$NON-NLS-1$ + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test010() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addFile(root, "p1/Test.txt", "This is a non-java resource"); + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(packageFragment); + IResource[] resources = JavaCore.getGeneratedResources(region, false); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 3, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + actualOutput = getResourceOuput(resources); + expectedOutput = + "/Project/bin/p1/Test.txt\n" + + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test011() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(packageFragment); + IResource[] resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.addFile(root, "p1/Test.txt", "This is a non-java resource"); + incrementalBuild(projectPath); + + resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 3, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + actualOutput = getResourceOuput(resources); + expectedOutput = + "/Project/bin/p1/Test.txt\n" + + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test012() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(packageFragment); + IResource[] resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.addFile(root, "p1/Test.txt", "This is a non-java resource"); + + resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + actualOutput = getResourceOuput(resources); + expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test013() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src", new Path[] {new Path("**/*.txt")}, null); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(packageFragment); + IResource[] resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.addFile(root, "p1/Test.txt", "This is a non-java resource"); + incrementalBuild(projectPath); + + resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + actualOutput = getResourceOuput(resources); + expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test014() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src", new Path[] {new Path("**/*.txt")}, null); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IPackageFragmentRoot root2 = project.getPackageFragmentRoot(project.getProject().getWorkspace().getRoot().findMember(root.makeAbsolute())); + IPackageFragment packageFragment = root2.getPackageFragment("p1");//$NON-NLS-1$ + IRegion region = JavaCore.newRegion(); + region.add(packageFragment); + IResource[] resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.addFile(root, "p1/Test.txt", "This is an excluded non-java resource"); + env.addFile(root, "p1/Test.log", "This is an included non-java resource"); + incrementalBuild(projectPath); + + resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 3, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + actualOutput = getResourceOuput(resources); + expectedOutput = + "/Project/bin/p1/Test.log\n" + + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test015() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src", new Path[] {new Path("**/*.txt")}, null); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Hello", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Hello {\n" + + " public class Z {}\n"+ //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(\"Hello world\");\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IJavaProject project = env.getJavaProject(projectPath); + IRegion region = JavaCore.newRegion(); + region.add(project); + IResource[] resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 2, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + String actualOutput = getResourceOuput(resources); + String expectedOutput = + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.addFile(root, "p1/Test.txt", "This is an excluded non-java resource"); + env.addFile(root, "p1/Test.log", "This is an included non-java resource"); + incrementalBuild(projectPath); + + resources = JavaCore.getGeneratedResources(region, true); + assertEquals("Wrong size", 3, resources.length);//$NON-NLS-1$ + Arrays.sort(resources, COMPARATOR); + actualOutput = getResourceOuput(resources); + expectedOutput = + "/Project/bin/p1/Test.log\n" + + "/Project/bin/p1/Hello.class\n" + + "/Project/bin/p1/Hello$Z.class\n"; + assertEquals("Wrong names", Util.convertToIndependantLineDelimiter(expectedOutput), actualOutput); + + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=6584 + public void test016() throws JavaModelException { + try { + JavaCore.getGeneratedResources(null, true); + assertTrue("Region cannot be null", false); + } catch(IllegalArgumentException e) { + // ignore: expected exception + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java new file mode 100644 index 0000000000..67f061434c --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java @@ -0,0 +1,1288 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import java.util.Hashtable; + +import junit.framework.Test; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class IncrementalTests extends BuilderTests { + + public IncrementalTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(IncrementalTests.class); + } + + /* + * Ensures that the source range for a duplicate secondary type error is correct + * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=77283) + */ + public void testAddDuplicateSecondaryType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "p", "C", + "package p; \n"+ + "public class C {} \n"+ + "class CC {}"); + + fullBuild(projectPath); + expectingNoProblems(); + + IPath pathToD = env.addClass(root, "p", "D", + "package p; \n"+ + "public class D {} \n"+ + "class CC {}"); + + incrementalBuild(projectPath); + expectingProblemsFor( + pathToD, + "Problem : The type CC is already defined [ resource : range : <37,39> category : <-1> severity : <2>]" + ); + expectingSpecificProblemsFor(pathToD, new Problem[] {new Problem("", "The type CC is already defined", pathToD, 37, 39, -1, IMarker.SEVERITY_ERROR)}); + env.removeProject(projectPath); + } + + public void testDefaultPackage() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); //$NON-NLS-1$ + + env.addClass(projectPath, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {A a;}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + public void testDefaultPackage2() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {A a;}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + public void testNewJCL() { + //---------------------------- + // Step 1 + //---------------------------- + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.addClass(root, "java.lang", "Object", //$NON-NLS-1$ //$NON-NLS-2$ + "package java.lang;\n" + //$NON-NLS-1$ + "public class Object {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + + incrementalBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 3 + //---------------------------- + env.addClass(root, "java.lang", "Throwable", //$NON-NLS-1$ //$NON-NLS-2$ + "package java.lang;\n" + //$NON-NLS-1$ + "public class Throwable {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + + incrementalBuild(); + expectingNoProblems(); + env.removeProject(projectPath); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=17329 + */ + public void testRenameMainType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + /* A.java */ + IPath pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class A {}"); //$NON-NLS-1$ + + /* B.java */ + IPath pathToB = env.addClass(root, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class B extends A {}"); //$NON-NLS-1$ + + /* C.java */ + IPath pathToC = env.addClass(root, "p", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class C extends B {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + /* Touch both A and C, removing A main type */ + pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class _A {}"); //$NON-NLS-1$ + + pathToC = env.addClass(root, "p", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class C extends B { }"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingProblemsFor( + new IPath[]{ pathToA, pathToB, pathToC }, + "Problem : A cannot be resolved to a type [ resource : range : <35,36> category : <40> severity : <2>]\n" + + "Problem : The hierarchy of the type C is inconsistent [ resource : range : <25,26> category : <40> severity : <2>]\n" + + "Problem : The public type _A must be defined in its own file [ resource : range : <25,27> category : <40> severity : <2>]" + ); + expectingSpecificProblemFor(pathToA, new Problem("_A", "The public type _A must be defined in its own file", pathToA, 25, 27, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(pathToB, new Problem("B", "A cannot be resolved to a type", pathToB, 35, 36, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(pathToC, new Problem("C", "The hierarchy of the type C is inconsistent", pathToC, 25, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + /* Touch both A and C, removing A main type */ + pathToA = env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class A {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=17807 + * case 1 + */ + public void testRemoveSecondaryType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + IPath pathToAB = env.addClass(root, "p", "AB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AB extends AZ {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "BB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class BB { \n"+ //$NON-NLS-1$ + " void foo(){ \n" + //$NON-NLS-1$ + " System.out.println(new AB()); \n" + //$NON-NLS-1$ + " System.out.println(new ZA()); \n" + //$NON-NLS-1$ + " } \n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class ZA {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + /* Remove AZ and touch BB */ + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "BB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class BB { \n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " System.out.println(new AB()); \n" + //$NON-NLS-1$ + " System.out.println(new ZA()); \n" + //$NON-NLS-1$ + " } \n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingProblemsFor( + pathToAB, + "Problem : AZ cannot be resolved to a type [ resource : range : <36,38> category : <40> severity : <2>]" + ); + expectingSpecificProblemFor(pathToAB, new Problem("AB", "AZ cannot be resolved to a type", pathToAB, 36, 38, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + /* + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=17807 + * case 2 + */ + public void testRemoveSecondaryType2() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "AB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AB extends AZ {}"); //$NON-NLS-1$ + + IPath pathToBB = env.addClass(root, "p", "BB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class BB { \n"+ //$NON-NLS-1$ + " void foo(){ \n" + //$NON-NLS-1$ + " System.out.println(new AB()); \n" + //$NON-NLS-1$ + " System.out.println(new ZA()); \n" + //$NON-NLS-1$ + " } \n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class ZA {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + /* Remove ZA and touch BB */ + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {}"); //$NON-NLS-1$ + + pathToBB = env.addClass(root, "p", "BB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class BB { \n"+ //$NON-NLS-1$ + " void foo() { \n" + //$NON-NLS-1$ + " System.out.println(new AB()); \n" + //$NON-NLS-1$ + " System.out.println(new ZA()); \n" + //$NON-NLS-1$ + " } \n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingProblemsFor( + pathToBB, + "Problem : ZA cannot be resolved to a type [ resource : range : <104,106> category : <40> severity : <2>]" + ); + expectingSpecificProblemFor(pathToBB, new Problem("BB.foo()", "ZA cannot be resolved to a type", pathToBB, 104, 106, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class ZA {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + public void testMoveSecondaryType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "AB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AB extends AZ {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + /* Move AZ from AA to ZZ */ + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + + /* Move AZ from ZZ to AA */ + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + public void testMoveMemberType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {static class M{}}"); //$NON-NLS-1$ + + env.addClass(root, "p", "AB", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "import p.AZ.*; \n"+ //$NON-NLS-1$ + "import p.ZA.*; \n"+ //$NON-NLS-1$ + "public class AB extends M {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class ZA {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingOnlySpecificProblemsFor( + root, + new Problem[]{ + new Problem("", "The import p.ZA is never used", new Path("/Project/src/p/AB.java"), 35, 39, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + + /* Move M from AA to ZZ */ + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class ZA {static class M{}}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingOnlySpecificProblemsFor( + root, + new Problem[]{ + new Problem("", "The import p.AZ is never used", new Path("/Project/src/p/AB.java"), 19, 23, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + + /* Move M from ZZ to AA */ + env.addClass(root, "p", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class AA {} \n"+ //$NON-NLS-1$ + "class AZ {static class M{}}"); //$NON-NLS-1$ + + env.addClass(root, "p", "ZZ", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class ZZ {} \n"+ //$NON-NLS-1$ + "class ZA {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingOnlySpecificProblemsFor( + root, + new Problem[]{ + new Problem("", "The import p.ZA is never used", new Path("/Project/src/p/AB.java"), 35, 39, CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + env.removeProject(projectPath); + } + + public void testMovePackage() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath[] exclusionPatterns = new Path[] {new Path("src2/")}; //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", exclusionPatterns, null); //$NON-NLS-1$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src1/src2"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(src1, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class A {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.removePackage(src1, "p"); //$NON-NLS-1$ + env.addClass(src2, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class A {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + public void testMovePackage2() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath other = env.addFolder(projectPath, "other"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath classA = env.addClass(src, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class A extends Missing {}"); //$NON-NLS-1$ + IPath classB = env.addClass(src, "p.q", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.q; \n"+ //$NON-NLS-1$ + "public class B extends Missing {}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingSpecificProblemFor( + classA, + new Problem("", "Missing cannot be resolved to a type", new Path("/Project/src/p/A.java"), 35, 42, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ); + expectingSpecificProblemFor( + classB, + new Problem("", "Missing cannot be resolved to a type", new Path("/Project/src/p/q/B.java"), 37, 44, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ); + + try { + IProject p = env.getProject(projectPath); + IFolder pFolder = p.getWorkspace().getRoot().getFolder(classA.removeLastSegments(1)); + pFolder.move(other.append("p"), true, false, null); + } catch (CoreException e) { + env.handle(e); + } + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } + + public void testMemberTypeFromClassFile() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class A extends Z {M[] m;}"); //$NON-NLS-1$ + + env.addClass(root, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class B {A a; E e; \n"+ //$NON-NLS-1$ + "void foo() { System.out.println(a.m); }}"); //$NON-NLS-1$ + + env.addClass(root, "p", "E", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class E extends Z { \n"+ //$NON-NLS-1$ + "void foo() { System.out.println(new M()); }}"); //$NON-NLS-1$ + + env.addClass(root, "p", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class Z {static class M {}}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class B {A a; E e; \n"+ //$NON-NLS-1$ + "void foo( ) { System.out.println(a.m); }}"); //$NON-NLS-1$ + + env.addClass(root, "p", "E", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class E extends Z { \n"+ //$NON-NLS-1$ + "void foo( ) { System.out.println(new M()); }}"); //$NON-NLS-1$ + + env.addClass(root, "p", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class Z { static class M {} }"); //$NON-NLS-1$ + + int previous = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; // reduce the lot size + incrementalBuild(projectPath); + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; + expectingNoProblems(); + env.removeProject(projectPath); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=372418 + public void testMemberTypeOfOtherProject() throws JavaModelException { + IPath projectPath1 = env.addProject("Project1", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath1, Util.getJavaClassLibs()); + + IPath projectPath2 = env.addProject("Project2", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath1, ""); //$NON-NLS-1$ + + IPath root1 = env.addPackageFragmentRoot(projectPath1, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath1, "bin"); //$NON-NLS-1$ + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath2, ""); //$NON-NLS-1$ + + IPath root2 = env.addPackageFragmentRoot(projectPath2, "src"); //$NON-NLS-1$ + IPath output2 = env.setOutputFolder(projectPath2, "bin"); //$NON-NLS-1$ + + env.addClassFolder(projectPath1, output2, true); + env.addRequiredProject(projectPath2, projectPath1); + + env.addClass(root1, "pB", "BaseClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pB; \n"+ //$NON-NLS-1$ + "public class BaseClass {\n" + //$NON-NLS-1$ + " public static class Builder {\n"+ //$NON-NLS-1$ + " public Builder(T t) {\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n");//$NON-NLS-1$ + + env.addClass(root1, "pR", "ReferencingClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pR; \n"+ //$NON-NLS-1$ + "import pD.DerivedClass.Builder;\n"+ //$NON-NLS-1$ + "public class ReferencingClass {\n" + //$NON-NLS-1$ + " Builder builder = new Builder(null);\n" + //$NON-NLS-1$ + "}\n"); //$NON-NLS-1$ + + env.addClass(root2, "pD", "DerivedClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pD; \n"+ //$NON-NLS-1$ + "public class DerivedClass extends pB.BaseClass {\n" + //$NON-NLS-1$ + " public static class Builder extends pB.BaseClass.Builder {\n"+ //$NON-NLS-1$ + " public Builder(T t) {\n" + //$NON-NLS-1$ + " super(t);\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n"); //$NON-NLS-1$ + + int previous = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + fullBuild(); + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; // reduce the lot size + cleanBuild(); + fullBuild(); + cleanBuild("Project1"); //$NON-NLS-1$ + fullBuild(projectPath1); + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; + expectingNoProblems(); + env.removeProject(projectPath1); + } + + //https://bugs.eclipse.org/bugs/show_bug.cgi?id=377401 + public void test$InTypeName() throws JavaModelException { + IPath projectPath1 = env.addProject("Project1", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath1, Util.getJavaClassLibs()); + + IPath projectPath2 = env.addProject("Project2", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath1, ""); //$NON-NLS-1$ + + IPath root1 = env.addPackageFragmentRoot(projectPath1, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath1, "bin"); //$NON-NLS-1$ + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath2, ""); //$NON-NLS-1$ + + IPath root2 = env.addPackageFragmentRoot(projectPath2, "src"); //$NON-NLS-1$ + IPath output2 = env.setOutputFolder(projectPath2, "bin"); //$NON-NLS-1$ + + env.addClassFolder(projectPath1, output2, true); + env.addRequiredProject(projectPath2, projectPath1); + + env.addClass(root1, "pB", "Builder$a", //$NON-NLS-1$ //$NON-NLS-2$ + "package pB; \n"+ //$NON-NLS-1$ + "public class Builder$a {\n" + //$NON-NLS-1$ + " public Builder$a(T t) {\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n");//$NON-NLS-1$ + + env.addClass(root1, "pR", "ReferencingClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pR; \n"+ //$NON-NLS-1$ + "import pD.DerivedClass$a;\n"+ //$NON-NLS-1$ + "public class ReferencingClass {\n" + //$NON-NLS-1$ + " DerivedClass$a builder = new DerivedClass$a(null);\n" + //$NON-NLS-1$ + "}\n"); //$NON-NLS-1$ + + env.addClass(root2, "pD", "DerivedClass$a", //$NON-NLS-1$ //$NON-NLS-2$ + "package pD; \n"+ //$NON-NLS-1$ + "public class DerivedClass$a extends pB.Builder$a {\n" + //$NON-NLS-1$ + " public DerivedClass$a(T t) {\n" + //$NON-NLS-1$ + " super(t);\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}\n"); //$NON-NLS-1$ + + int previous = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + fullBuild(); + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; // reduce the lot size + cleanBuild(); + fullBuild(); + cleanBuild("Project1"); //$NON-NLS-1$ + fullBuild(projectPath1); + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = previous; + expectingNoProblems(); + env.removeProject(projectPath1); + } + + // http://dev.eclipse.org/bugs/show_bug.cgi?id=27658 + public void testObjectWithSuperInterfaces() throws JavaModelException { + try { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "java.lang", "Object", //$NON-NLS-1$ //$NON-NLS-2$ + "package java.lang; \n"+ //$NON-NLS-1$ + "public class Object implements I {} \n"+ //$NON-NLS-1$ + "interface I {} \n"); //$NON-NLS-1$ + + fullBuild(projectPath); + + expectingOnlySpecificProblemsFor( + root, + new Problem[]{ + new Problem("", "The type java.lang.Object cannot have a superclass or superinterfaces", new Path("/Project/src/java/lang/Object.java"), 33, 39, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + + env.addClass(root, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class X {}\n"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + + expectingOnlySpecificProblemsFor( + root, + new Problem[]{ + new Problem("", "The type java.lang.Object cannot have a superclass or superinterfaces", new Path("/Project/src/java/lang/Object.java"), 33, 39, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + + env.addClass(root, "p", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p; \n"+ //$NON-NLS-1$ + "public class Y extends X {}\n"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + + expectingOnlySpecificProblemsFor( + root, + new Problem[]{ + new Problem("", "The type java.lang.Object cannot have a superclass or superinterfaces", new Path("/Project/src/java/lang/Object.java"), 33, 39, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }); + env.removeProject(projectPath); + + } catch(StackOverflowError e){ + assertTrue("Infinite loop in cycle detection", false); //$NON-NLS-1$ + e.printStackTrace(); + } + } + + /** + * Bugs 6461 + * TODO excluded test + */ + public void _testWrongCompilationUnitLocation() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + IPath x = env.addClass(root, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(bin.append("X.class")); //$NON-NLS-1$ + + //---------------------------- + // Step 2 + //---------------------------- + env.addClass(root, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingProblemsFor(x, "???"); + expectingNoPresenceOf(bin.append("X.class")); //$NON-NLS-1$ + env.removeProject(projectPath); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=100631 + public void testMemberTypeCollisionWithBinary() throws JavaModelException { + int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + " Object foo(B b) { return b.i; }\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + env.addClass(root, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {\n"+ //$NON-NLS-1$ + " I.InnerType i;\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + env.addClass(root, "", "I", //$NON-NLS-1$ //$NON-NLS-2$ + "public interface I {\n"+ //$NON-NLS-1$ + " interface InnerType {}\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; + + env.addClass(root, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + " Object foo(B b) { return b.i; }\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + env.addClass(root, "", "I", //$NON-NLS-1$ //$NON-NLS-2$ + "public interface I {\n"+ //$NON-NLS-1$ + " interface InnerType {}\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; + } + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=191739 + public void testMemberTypeCollisionWithBinary2() throws JavaModelException { + int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1"); //$NON-NLS-1$ + IPath bin1 = env.setOutputFolder(projectPath, "bin1"); //$NON-NLS-1$ + + env.addClass(src1, "p1", "NoSource", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1; \n"+ + "import p2.Foo;\n"+ //$NON-NLS-1$ + "public class NoSource {\n"+ //$NON-NLS-1$ + " public NoSource(Foo.Bar b) {}\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(src2, "p2", "Foo", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2; \n"+ + "public class Foo {\n"+ //$NON-NLS-1$ + " public static class Bar {\n" + //$NON-NLS-1$ + " public static Bar LocalBar = new Bar();\n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + env.addClass(src2, "p2", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2; \n"+ + "import p1.NoSource;\n"+ //$NON-NLS-1$ + "import p2.Foo.Bar;\n"+ //$NON-NLS-1$ + "public class Test {\n"+ //$NON-NLS-1$ + " NoSource nosrc = new NoSource(Bar.LocalBar);\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.removePackageFragmentRoot(projectPath, "src1"); //$NON-NLS-1$ + env.addClassFolder(projectPath, bin1, false); + + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; + + env.addClass(src2, "p2", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2; \n"+ + "import p1.NoSource;\n"+ //$NON-NLS-1$ + "import p2.Foo.Bar;\n"+ //$NON-NLS-1$ + "public class Test {\n"+ //$NON-NLS-1$ + " NoSource nosrc = new NoSource(Bar.LocalBar);\n" + //$NON-NLS-1$ + "}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; + } + } + + + public void test129316() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); //$NON-NLS-1$ + + IPath yPath = env.addClass(projectPath, "p", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + + "public class Y extends Z {}"); //$NON-NLS-1$ + + env.addClass(projectPath, "p", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + + "public class Z {}"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "import p.Y;\n" + + "public class X {\n" + + " boolean b(Object o) {\n" + + " return o instanceof Y;\n" + + " }\n" + + "}"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "p", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + + "public class Y extends Zork {}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingSpecificProblemFor(yPath, new Problem("Y", "Zork cannot be resolved to a type", yPath, 34, 38, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + IPath xPath = env.addClass(projectPath, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {\n" + + " boolean b(Object o) {\n" + + " return o instanceof p.Y;\n" + + " }\n" + + "}"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingSpecificProblemFor(yPath, new Problem("Y", "Zork cannot be resolved to a type", yPath, 34, 38, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoProblemsFor(xPath); + env.removeProject(projectPath); + } + + public void testSecondaryType() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "AB", //$NON-NLS-1$ //$NON-NLS-2$ + "public class AB { AZ z = new AA();}"); //$NON-NLS-1$ + + env.addClass(root, "", "AA", //$NON-NLS-1$ //$NON-NLS-2$ + "public class AA extends AZ {} \n"+ //$NON-NLS-1$ + "class AZ {}"); //$NON-NLS-1$ + + int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + try { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = 1; + fullBuild(projectPath); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; + } + expectingNoProblems(); + env.removeProject(projectPath); + } + + // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation + public void testMissingType001() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath xPath = env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo(p2.Y y) { \n" + //$NON-NLS-1$ + " y.bar(null);" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " void X() {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + IPath yPath = env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " public void bar(Z z) {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + fullBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(yPath, new Problem("Y", "Z cannot be resolved to a type", yPath, 46, 47, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); + } + + // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation + public void testMissingType002() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath yPath = env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " public void bar(Z z) {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + fullBuild(projectPath); + expectingSpecificProblemFor(yPath, new Problem("Y", "Z cannot be resolved to a type", yPath, 46, 47, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + IPath xPath = env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo(p2.Y y) { \n" + //$NON-NLS-1$ + " y.bar(null);" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " void X() {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(yPath, new Problem("Y", "Z cannot be resolved to a type", yPath, 46, 47, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p2", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); + } + + // http://dev.eclipse.org/bugs/show_bug.cgi?id=196200 - variation + public void testMissingType003() throws JavaModelException { + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath yPath = env.addClass(root, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " public void bar(p1.Z z) {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + fullBuild(projectPath); + expectingSpecificProblemFor(yPath, new Problem("Y", "p1 cannot be resolved to a type", yPath, 46, 48, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + IPath xPath = env.addClass(root, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void foo(p2.Y y) { \n" + //$NON-NLS-1$ + " y.bar(null);" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + " void X() {}\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(yPath, new Problem("Y", "p1.Z cannot be resolved to a type", yPath, 46, 50, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(root, "p1", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "This method has a constructor name", xPath, 73, 76, CategorizedProblem.CAT_CODE_STYLE, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=334377 + public void testBug334377() throws JavaModelException { + int max = org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE; + Hashtable options = null; + try { + options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_5); + newOptions.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_1_5); + newOptions.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_1_5); + JavaCore.setOptions(newOptions); + + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "Upper", + "public abstract class Upper {\n" + + " public static enum Mode {IN,OUT;}\n" + + "}\n"); + env.addClass(root, "", "Lower", + "public class Lower extends Upper {};\n"); + env.addClass(root, "", "Bug", + "public class Bug {\n" + + " Upper.Mode m1;\n" + + " void usage(){\n" + + " Lower.Mode m3;\n" + + " if (m1 == null){\n" + + " m3 = Lower.Mode.IN;\n" + + " } else {\n" + + " m3 = m1;\n" + + " }\n" + + " Lower.Mode m2 = (m1 == null ? Lower.Mode.IN : m1);\n" + + " System.out.println(m2);\n" + + " System.out.println(m3);\n" + + " }\n" + + "}\n"); + + fullBuild(projectPath); + expectingNoProblems(); + env.addClass(root, "", "Bug", + "public class Bug {\n" + + " Upper.Mode m1;\n" + + " void usage(){\n" + + " Lower.Mode m3;\n" + + " if (m1 == null){\n" + + " m3 = Lower.Mode.IN;\n" + + " } else {\n" + + " m3 = m1;\n" + + " }\n" + + " Lower.Mode m2 = (m1 == null ? Lower.Mode.IN : m1);\n" + + " System.out.println(m2);\n" + + " System.out.println(m3);\n" + + " }\n" + + "}\n"); + + incrementalBuild(projectPath); + expectingNoProblems(); + env.removeProject(projectPath); + } finally { + org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.MAX_AT_ONCE = max; + JavaCore.setOptions(options); + } + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=364450 + // Incremental build should not generate buildpath error + // NOT generated by full build. + public void testBug364450() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath wPath = env.addClass(projectPath, "w", "W", //$NON-NLS-1$ //$NON-NLS-2$ + "package w;\n" + + "public class W {\n" + + " private w.I i;}"); //$NON-NLS-1$ + + IPath aPath = env.addClass(projectPath, "a", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "import w.I;\n" + + "import w.W;\n" + + "public class A {}"); //$NON-NLS-1$ + env.waitForManualRefresh(); + fullBuild(projectPath); + env.waitForAutoBuild(); + expectingSpecificProblemFor(wPath, new Problem("W", "w.I cannot be resolved to a type", wPath, 37, 40, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "The import w.I cannot be resolved", aPath, 18, 21, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + aPath = env.addClass(projectPath, "a", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "import w.I;\n" + + "import w.W;\n" + + "public class A {}"); //$NON-NLS-1$ + + env.waitForManualRefresh(); + incrementalBuild(projectPath); + env.waitForAutoBuild(); + expectingSpecificProblemFor(aPath, new Problem("A", "The import w.I cannot be resolved", aPath, 18, 21, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(projectPath); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=520640 + public void testRemovePackageInDependencyProject() throws JavaModelException { + IPath projectPath1 = env.addProject("Project1"); + env.addExternalJars(projectPath1, Util.getJavaClassLibs()); + + IPath projectPath2 = env.addProject("Project2"); + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + + + env.addRequiredProject(projectPath1, projectPath2); + + env.addPackage(projectPath2, "emptypackage"); + + fullBuild(); + expectingNoProblems(); + + env.removePackage(projectPath2, "emptypackage"); + incrementalBuild(); + expectingNoProblems(); + + env.removeProject(projectPath2); + env.removeProject(projectPath1); + } + + public void testBug526376() throws JavaModelException { + IPath projectPath = env.addProject("Project"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "p", "A", + "package p; \n"+ + "public class A extends B {} \n"); + + fullBuild(projectPath); + + env.addClass(root, "p", "B", + "package p; \n"+ + "public class B {}\n"); + + incrementalBuild(projectPath); + expectingCompilingOrder(new String[] { "/Project/src/p/B.java", "/Project/src/p/A.java" }); + expectingNoProblems(); + env.removeProject(projectPath); + } + +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java new file mode 100644 index 0000000000..6ba1d5820d --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests18.java @@ -0,0 +1,811 @@ +/******************************************************************************* + * Copyright (c) 2013, 2015 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.builder; + +import java.io.File; +import junit.framework.Test; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.osgi.framework.Bundle; + +public class IncrementalTests18 extends BuilderTests { + static { +// TESTS_NAMES = new String[] { "testBug481276b" }; + } + public IncrementalTests18(String name) { + super(name); + } + + public static Test suite() { + return AbstractCompilerTest.buildUniqueComplianceTestSuite(IncrementalTests18.class, ClassFileConstants.JDK1_8); + } + + private void setupProjectForNullAnnotations() throws JavaModelException { + // add the org.eclipse.jdt.annotation library (bin/ folder or jar) to the project: + Bundle[] bundles = Platform.getBundles("org.eclipse.jdt.annotation","[2.0.0,3.0.0)"); + File bundleFile = FileLocator.getBundleFileLocation(bundles[0]).get(); + String annotationsLib = bundleFile.isDirectory() ? bundleFile.getPath()+"/bin" : bundleFile.getPath(); + IJavaProject javaProject = env.getJavaProject("Project"); + IClasspathEntry[] rawClasspath = javaProject.getRawClasspath(); + int len = rawClasspath.length; + System.arraycopy(rawClasspath, 0, rawClasspath = new IClasspathEntry[len+1], 0, len); + rawClasspath[len] = JavaCore.newLibraryEntry(new Path(annotationsLib), null, null); + javaProject.setRawClasspath(rawClasspath, null); + + javaProject.setOption(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=423122, [1.8] Missing incremental build dependency from lambda expression to functional interface. + public void test423122() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "p", "I", + "package p; \n"+ + "public interface I { void foo(); } \n" + ); + env.addClass(root, "p", "X", + "package p; \n"+ + "public class X { I i = () -> {}; } \n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p", "I", + "package p; \n"+ + "public interface I { } \n" + ); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : The target type of this expression must be a functional interface [ resource : range : <35,40> category : <40> severity : <2>]" + ); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=423122, [1.8] Missing incremental build dependency from lambda expression to functional interface. + public void test423122a() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "test1", "I", + "package test1;\n" + + "public interface I {\n" + + " int method(int a); // change argument type to Object\n" + + "}\n" + ); + env.addClass(root, "test1", "E", + "package test1;\n" + + "public class E {\n" + + " void take(I i) {\n" + + " }\n" + + "}\n" + ); + env.addClass(root, "test1", "Ref", + "package test1;\n" + + "public class Ref {\n" + + " void foo(E e) {\n" + + " e.take((x) -> x+2); // not recompiled when I#method changed\n" + + " }\n" + + "}\n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "test1", "I", + "package test1;\n" + + "public interface I {\n" + + " int method(Object a); // change argument type to Object\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : The operator + is undefined for the argument type(s) Object, int [ resource : range : <76,79> category : <60> severity : <2>]" + ); + env.addClass(root, "test1", "I", + "package test1;\n" + + "public interface I {\n" + + " int method(int a); // change argument type back to int\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingNoProblems(); + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=427105, [1.8][builder] Differences between incremental and full builds in method contract verification in the presence of type annotations + public void test427105() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "", "X", + "import java.util.List;\n" + + "public class X implements I {\n" + + " public void f(List x, List ls) { \n" + + " }\n" + + "}\n" + ); + env.addClass(root, "", "I", + "import java.util.List;\n" + + "public interface I {\n" + + " void f(@T List x, List ls);\n" + + "}\n" + ); + env.addClass(root, "", "T", + "import java.lang.annotation.ElementType;\n" + + "import java.lang.annotation.Target;\n" + + "@Target(ElementType.TYPE_USE)\n" + + "public @interface T {\n" + + "}\n" + ); + + // force annotation encoding into bindings which is necessary to reproduce. + env.getJavaProject("Project").setOption(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); + + fullBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <55,59> category : <130> severity : <1>]\n" + + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <68,72> category : <130> severity : <1>]" + ); + env.addClass(root, "", "X", + "import java.util.List;\n" + + "public class X implements I {\n" + + " public void f(List x, List ls) { \n" + + " }\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <55,59> category : <130> severity : <1>]\n" + + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <68,72> category : <130> severity : <1>]" + ); + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=427105, [1.8][builder] Differences between incremental and full builds in method contract verification in the presence of type annotations + public void test427105a() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "", "X", + "import java.util.List;\n" + + "public class X implements I {\n" + + " public void f(List x, List ls) { \n" + + " }\n" + + "}\n" + ); + env.addClass(root, "", "I", + "import java.util.List;\n" + + "public interface I {\n" + + " void f(@T List x, List ls);\n" + + "}\n" + ); + env.addClass(root, "", "T", + "import java.lang.annotation.ElementType;\n" + + "import java.lang.annotation.Target;\n" + + "@Target(ElementType.TYPE_USE)\n" + + "public @interface T {\n" + + "}\n" + ); + + // force annotation encoding into bindings which is necessary to reproduce. + env.getJavaProject("Project").setOption(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); + + fullBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <55,59> category : <130> severity : <1>]\n" + + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <68,72> category : <130> severity : <1>]" + ); + env.addClass(root, "", "X", + "import java.util.List;\n" + + "public class X implements I {\n" + + " public void f(@T List x, List ls) { \n" + + " }\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <55,59> category : <130> severity : <1>]\n" + + "Problem : List is a raw type. References to generic type List should be parameterized [ resource : range : <71,75> category : <130> severity : <1>]" + ); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=428071, [1.8][compiler] Bogus error about incompatible return type during override + public void test428071() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "", "K1", + "import java.util.List;\n" + + "import java.util.Map;\n" + + "interface K1 {\n" + + " public Map get();\n" + + "}\n" + ); + env.addClass(root, "", "K", + "import java.util.List;\n" + + "import java.util.Map;\n" + + "public class K implements K1 {\n" + + " public Map get() {\n" + + " return null;\n" + + " }\n" + + "}\n" + ); + env.getJavaProject("Project").setOption(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.IGNORE); + fullBuild(projectPath); + expectingNoProblems(); + env.addClass(root, "", "K", + "import java.util.List;\n" + + "import java.util.Map;\n" + + "public class K implements K1 {\n" + + " public Map get() {\n" + + " return null;\n" + + " }\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingNoProblems(); + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=430425, [1.8][compiler] Type mismatch: cannot convert from StyleConverter to StyleConverter + public void test430425() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + String jreDirectory = Util.getJREDirectory(); + String jfxJar = Util.toNativePath(jreDirectory + "/lib/ext/jfxrt.jar"); + File file = new File(jfxJar); + if (file.exists()) + env.addExternalJars(projectPath, Util.concatWithClassLibs(jfxJar, false)); + else + return; + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "javafx.css", "StyleConverter", + "package javafx.css;\n" + + "import com.sun.javafx.css.converters.InsetsConverter;\n" + + "import javafx.geometry.Insets;\n" + + "public class StyleConverter {\n" + + " public static StyleConverter getInsetsConverter() {\n" + + " return InsetsConverter.getInstance();\n" + + " }\n" + + " void fred5555() {\n" + + " }\n" + + "}\n" + ); + env.addClass(root, "com.sun.javafx.css.converters", "InsetsConverter", + "package com.sun.javafx.css.converters;\n" + + "import com.sun.javafx.css.StyleConverterImpl;\n" + + "import javafx.css.ParsedValue;\n" + + "import javafx.css.StyleConverter;\n" + + "import javafx.geometry.Insets;\n" + + "public final class InsetsConverter extends StyleConverterImpl {\n" + + " public static StyleConverter getInstance() {\n" + + " return null;\n" + + " }\n" + + "}\n" + ); + env.addClass(root, "javafx.css", "ParsedValue", + "package javafx.css;\n" + + "public class ParsedValue {\n" + + "}\n" + ); + env.getJavaProject("Project").setOption(JavaCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaCore.IGNORE); + fullBuild(projectPath); + expectingNoProblems(); + env.addClass(root, "javafx.css", "StyleConverter", + "package javafx.css;\n" + + "import com.sun.javafx.css.converters.InsetsConverter;\n" + + "import javafx.geometry.Insets;\n" + + "public class StyleConverter {\n" + + " public static StyleConverter getInsetsConverter() {\n" + + " return InsetsConverter.getInstance();\n" + + " }\n" + + " void fred555() {\n" + + " }\n" + + "}\n" + ); + incrementalBuild(projectPath); + expectingNoProblems(); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=435544, [compiler][null] Enum constants not recognised as being NonNull (take2) + public void test435544() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + setupProjectForNullAnnotations(); + env.addClass(root, "p", "Y", + "package p; \n" + + "public enum Y {\n" + + " A,\n" + + " B\n" + + "}\n" + + "\n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "p", "X", + "package p; \n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class X {\n" + + " @NonNull\n" + + " public Y y = Y.A; // warning without fix\n" + + " void foo(@NonNull Y y) {}\n" + + " void bar() {\n" + + " foo(Y.A); // warning without fix\n" + + " }\n" + + "}\n" + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=442452, [compiler][regression] Bogus error: The interface Comparable cannot be implemented more than once with different arguments + public void testBug442452() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "Entity", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Entity implements IEntity {\n" + + " public int compareTo(IBasicItem o) {\n" + + " return 0;\n" + + " }\n" + + "}\n"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "IEntity", //$NON-NLS-1$ //$NON-NLS-2$ + "public interface IEntity> extends IBasicItem {\n" + + "}\n"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "IBasicItem", //$NON-NLS-1$ //$NON-NLS-2$ + "public interface IBasicItem extends Comparable {\n" + + "}\n"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "IAdvancedItem", //$NON-NLS-1$ //$NON-NLS-2$ + "public interface IAdvancedItem extends Comparable {\n" + + "}\n"); //$NON-NLS-1$ + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "", "Entity", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Entity implements IEntity, IAdvancedItem {\n" + + " public int compareTo(IBasicItem o) {\n" + + " return 0;\n" + + " }\n" + + "}\n"); //$NON-NLS-1$ + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=442755, + // [compiler] NPE at ProblemHandler.handle + public void testBug442755() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); + env.addClass(projectPath, "", "Z", + "public interface Z {}\n"); + fullBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : X cannot be resolved to a type [ resource : " + + " range : <31,32> category : <40> severity : <2>]\n" + + "Problem : Y cannot be resolved to a type [ resource : " + + " range : <45,46> category : <40> severity : <2>]"); + env.addClass(projectPath, "", "Unmarshaller", //$NON-NLS-1$ //$NON-NLS-2$ + "public abstract class Unmarshaller {\n" + + " public CONTEXT getContext() {\n" + + " return null;\n" + + " }\n" + + "}\n"); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : The project was not built since its build path is incomplete." + + " Cannot find the class file for Y. Fix the build path then try building" + + " this project [ resource : range : <-1,-1> category : <10> severity : <2>]\n" + + "Problem : The type Y cannot be resolved. It is indirectly referenced from" + + " required .class files [ resource : range : <0,1> category : <10> severity : <2>]"); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=442755, + // [compiler] NPE at ProblemHandler.handle + // Simplified test case. + public void testBug442755a() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, "bin"); + env.addClass(projectPath, "", "Z", + "public class Z {}\n"); + fullBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : Y cannot be resolved to a type [ resource : " + + " range : <27,28> category : <40> severity : <2>]"); + env.addClass(projectPath, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {}\n"); + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : The project was not built since its build path is incomplete." + + " Cannot find the class file for Y. Fix the build path then try building" + + " this project [ resource : range : <-1,-1> category : <10> severity : <2>]\n" + + "Problem : The type Y cannot be resolved. It is indirectly referenced from" + + " required .class files [ resource : range : <0,1> category : <10> severity : <2>]"); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=445049, + // [compiler] java.lang.ClassCastException: org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding + // cannot be cast to org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding + public void test445049() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + setupProjectForNullAnnotations(); + env.addClass(root, "", "I", + "public interface I { int f = 0;}"); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(root, "", "X", "class X implements I { int i = I.super.f;}"); + + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : No enclosing instance of the type I is accessible in scope [" + + " resource : range : <31,38> category : <40> severity : <2>]"); + } + + public void testBug481276a() throws Exception { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + setupProjectForNullAnnotations(); + + // clean status from https://bugs.eclipse.org/bugs/attachment.cgi?id=257687 + env.addClass(root, "testNullAnnotations", "package-info", + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package testNullAnnotations;\n"); + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import org.eclipse.jdt.annotation.Nullable;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static T[] checkNotNull(T @Nullable [] array) {\n" + + " if (array == null) {\n" + + " throw new NullPointerException();\n" + + " }\n" + + " return array;\n" + + " }\n" + + "}\n"); + env.addClass(root, "testNullAnnotations", "Snippet", + "package testNullAnnotations;\n" + + "\n" + + "import static testNullAnnotations.NonNullUtils.checkNotNull;\n" + + "\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "public class Snippet {\n" + + " @SuppressWarnings(\"unused\")\n" + + " public void foo() {\n" + + " @NonNull Object @Nullable [] objects = null;\n" + + " @NonNull Object @NonNull [] checked3 = checkNotNull(objects); \n" + + " }\n" + + "}\n"); + + fullBuild(projectPath); + expectingNoProblems(); + + // add an error by removing the necessary @Nullable annotation: + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static T[] checkNotNull(T [] array) {\n" + + " if (array == null) {\n" + + " throw new NullPointerException();\n" + + " }\n" + + " return array;\n" + + " }\n" + + "}\n"); + + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : Dead code [" + + " resource : range : <145,202> category : <90> severity : <1>]\n" + + "Problem : Null type mismatch: required \'@NonNull Object @NonNull[]\' but the provided value is null [" + + " resource : range : <316,323> category : <90> severity : <2>]"); + } + + public void testBug481276b() throws Exception { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + setupProjectForNullAnnotations(); + // clean status: + env.addClass(root, "testNullAnnotations", "package-info", + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package testNullAnnotations;\n"); + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import org.eclipse.jdt.annotation.Nullable;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static <@Nullable T> T[] checkNotNull(T @Nullable[] array) {\n" + + " if (array == null) {\n" + + " throw new NullPointerException();\n" + + " }\n" + + " return array;\n" + + " }\n" + + "}\n"); + env.addClass(root, "testNullAnnotations", "Snippet", + "package testNullAnnotations;\n" + + "\n" + + "import static testNullAnnotations.NonNullUtils.checkNotNull;\n" + + "\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "public class Snippet {\n" + + " @SuppressWarnings(\"unused\")\n" + + " public void foo() {\n" + + " @NonNull Object @Nullable [] objects = new @NonNull Object[0];\n" + + " @NonNull Object @NonNull [] checked3 = checkNotNull(objects); \n" + + " }\n" + + "}\n"); + + fullBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : Null type mismatch (type annotations): required \'@NonNull Object @NonNull[]\' but this expression has type \'@Nullable Object @NonNull[]\' [" + + " resource : range : <321,342> category : <90> severity : <2>]\n" + + "Problem : Null type mismatch (type annotations): required \'@Nullable Object @Nullable[]\' but this expression has type \'@NonNull Object @Nullable[]\' [" + + " resource : range : <334,341> category : <90> severity : <2>]"); + + // fix error according to https://bugs.eclipse.org/bugs/show_bug.cgi?id=481276#c4 + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import org.eclipse.jdt.annotation.Nullable;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static T[] checkNotNull(T @Nullable[] array) {\n" + + " if (array == null) {\n" + + " throw new NullPointerException();\n" + + " }\n" + + " return array;\n" + + " }\n" + + "}\n"); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testBug481276c() throws Exception { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + setupProjectForNullAnnotations(); + + // clean status from https://bugs.eclipse.org/bugs/attachment.cgi?id=257687 + env.addClass(root, "testNullAnnotations", "package-info", + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package testNullAnnotations;\n"); + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import org.eclipse.jdt.annotation.Nullable;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static T[] checkNotNull(T @Nullable [] array) {\n" + + " if (array == null) {\n" + + " throw new NullPointerException();\n" + + " }\n" + + " return array;\n" + + " }\n" + + "}\n"); + env.addClass(root, "testNullAnnotations", "Snippet", + "package testNullAnnotations;\n" + + "\n" + + "import static testNullAnnotations.NonNullUtils.checkNotNull;\n" + + "\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "public class Snippet {\n" + + " @SuppressWarnings(\"unused\")\n" + + " public void foo() {\n" + + " @NonNull Object @Nullable [] objects = null;\n" + + " @NonNull Object @NonNull [] checked3 = checkNotNull(objects); \n" + + " }\n" + + "}\n"); + + fullBuild(projectPath); + expectingNoProblems(); + + // add a warning by making @NNBD ineffective: + env.addClass(root, "testNullAnnotations", "package-info", + "@org.eclipse.jdt.annotation.NonNullByDefault({})\n" + + "package testNullAnnotations;\n"); + + incrementalBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : Null type safety (type annotations): The expression of type \'@NonNull Object []\' needs unchecked conversion to conform to \'@NonNull Object @NonNull[]\' [" + + " resource : range : <303,324> category : <90> severity : <1>]"); + } + + public void testBug483744_remove() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.8"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + setupProjectForNullAnnotations(); + + env.addClass(root, "testNullAnnotations", "package-info", + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package testNullAnnotations;\n"); + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import java.util.*;\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static List<@NonNull T> checkNotNullContents(List<@Nullable T> list, List<@NonNull T> nList) {\n" + + " return nList;\n" + + " }\n" + + "}\n"); + env.addClass(root, "testNullAnnotations", "Snippet", + "package testNullAnnotations;\n" + + "\n" + + "import java.util.*;\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "import static testNullAnnotations.NonNullUtils.checkNotNullContents;\n" + + "\n" + + "public class Snippet {\n" + + " public List<@NonNull String> foo(List<@Nullable String> inList, List<@NonNull String> nList) {\n" + + " return checkNotNullContents(inList, nList); \n" + + " }\n" + + "}\n"); + + fullBuild(projectPath); + expectingNoProblems(); + + // remove @Nullable (second type annotation): + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import java.util.*;\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static List<@NonNull T> checkNotNullContents(List list, List<@NonNull T> nList) {\n" + + " return nList;\n" + + " }\n" + + "}\n"); + incrementalBuild(projectPath); // was throwing NPE + expectingNoProblems(); + + // and add it again: + env.addClass(root, "testNullAnnotations", "NonNullUtils", + "package testNullAnnotations;\n" + + "\n" + + "import java.util.*;\n" + + "import org.eclipse.jdt.annotation.*;\n" + + "\n" + + "public final class NonNullUtils {\n" + + "\n" + + " public static List<@NonNull T> checkNotNullContents(List<@Nullable T> list, List<@NonNull T> nList) {\n" + + " return nList;\n" + + " }\n" + + "}\n"); + incrementalBuild(projectPath); // was throwing NPE + expectingNoProblems(); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Java50Tests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Java50Tests.java new file mode 100644 index 0000000000..c5fc66ebc2 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Java50Tests.java @@ -0,0 +1,382 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 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.builder; + +import junit.framework.Test; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; + +public class Java50Tests extends BuilderTests { + + public Java50Tests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(Java50Tests.class); + } + + public void testAnnotation() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + IPath usePath = env.addClass(projectPath, "p", "Use", + "package p;\n" + + "@q.Ann\n" + + "public class Use {\n" + + "}" + ); + env.addClass(projectPath, "q", "Ann", + "package q;\n" + + "public @interface Ann {\n" + + "}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "q", "Ann", + "package q;\n" + + "import java.lang.annotation.*;\n" + + "@Target(ElementType.METHOD)\n" + + "public @interface Ann {\n" + + "}" + ); + + incrementalBuild(projectPath); + expectingProblemsFor( + usePath, + "Problem : The annotation @Ann is disallowed for this location [ resource : range : <11,17> category : <40> severity : <2>]" + ); + } + + public void testHierarchyCycle() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + env.addClass(projectPath, "", "A", + "interface A {}\n" + + "interface B extends A {}\n" + + "interface D extends C {}" + ); + env.addClass(projectPath, "", "C", + "interface C extends B {}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=214237, dupe of + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=205235 + public void testHierarchyCycleInstanceof() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + env.addClass(projectPath, "", "A", + "import java.util.Collection;\n" + + "public abstract class A\n" + + ",S extends Collection> {}\n" + + // a specific grouping of classes is needed to hit the problem using + // the test framework + "abstract class B extends A> {\n" + + " boolean isD() {return this instanceof D;}\n" + + "}\n"+ + "final class D extends C {}\n" + ); + env.addClass(projectPath, "", "C", + "public abstract class C extends B {\n" + + " boolean isD() {return this instanceof D;}\n" + + "}\n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + } + + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=231293 + public void testMissingRequiredBinaries() throws JavaModelException { + + IPath p1 = env.addProject("P1", "1.5"); //$NON-NLS-1$ + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + IPath p2bin = env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " public void foo(int i) {}\n"+ //$NON-NLS-1$ + " public void foo(int i, Z z) {}\n"+ //$NON-NLS-1$ + "}\n"+ //$NON-NLS-1$ + "class Z {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + + env.addClassFolder(p1, p2bin, false); + env.removeFile(p2bin.append("p2/Z.class")); //$NON-NLS-1$ + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " void test(p2.Y y) { y.foo(1); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(p1); + expectingNoProblems(); + + IPath xx = env.addClass(root1, "p1", "XX", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class XX {\n"+ //$NON-NLS-1$ + " void test(p2.Y y) { y.foo('c', null); }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(p1); + expectingOnlySpecificProblemsFor(p1,new Problem[]{ + new Problem("p1", "The project was not built since its build path is incomplete. Cannot find the class file for p2.Z. Fix the build path then try building this project", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p1", "The type p2.Z cannot be resolved. It is indirectly referenced from required .class files", xx, 51, 67, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)//$NON-NLS-1$ //$NON-NLS-2$ + }); + } + + public void testParameterizedMemberType() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + IPath xPath = env.addClass(projectPath, "", "X", + "class X extends A {}" + ); + + IPath aPath = env.addClass(projectPath, "", "A", + "class A extends B.M> {}" + ); + + IPath bPath = env.addClass(projectPath, "", "B", + "class B extends Missing {\n" + + " class M{}\n" + + "}\n" + + "class Missing {}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "", "B", + "class B extends Missing {\n" + + " class M{}\n" + + "}" + ); + + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "The hierarchy of the type X is inconsistent", xPath, 6, 7, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "The hierarchy of the type A is inconsistent", aPath, 6, 7, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(bPath, new Problem("B", "Missing cannot be resolved to a type", bPath, 19, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(projectPath, "", "X", + "class X extends A {}" + ); + + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "The hierarchy of the type X is inconsistent", xPath, 6, 7, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "The hierarchy of the type A is inconsistent", aPath, 6, 7, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(bPath, new Problem("B", "Missing cannot be resolved to a type", bPath, 19, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(projectPath, "", "B", + "class B extends Missing {\n" + + " class M{}\n" + + "}" + ); + + incrementalBuild(projectPath); + expectingSpecificProblemFor(xPath, new Problem("X", "The hierarchy of the type X is inconsistent", xPath, 6, 7, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(aPath, new Problem("A", "The hierarchy of the type A is inconsistent", aPath, 6, 7, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingSpecificProblemFor(bPath, new Problem("B", "Missing cannot be resolved to a type", bPath, 19, 26, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + env.addClass(projectPath, "", "B", + "class B extends Missing {\n" + + " class M{}\n" + + "}\n" + + "class Missing {}" + ); + + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testParameterizedType1() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + IPath usePath = env.addClass(projectPath, "p", "Use", + "package p;\n" + + "import java.util.ArrayList;\n" + + "import q.Other;\n" + + "public class Use {\n" + + " public Use() {\n" + + " new Other().foo(new ArrayList());\n" + + " }\n" + + "}" + ); + env.addClass(projectPath, "q", "Other", + "package q;\n" + + "import java.util.List;\n" + + "public class Other {\n" + + " public void foo(List ls) {}\n" + + "}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "q", "Other", + "package q;\n" + + "import java.util.List;\n" + + "public class Other {\n" + + " public void foo(List ls) {}\n" + + "}" + ); + + incrementalBuild(projectPath); + expectingProblemsFor( + usePath, + "Problem : The method foo(List) in the type Other is not applicable for the arguments (ArrayList) [ resource : range : <104,107> category : <50> severity : <2>]" + ); + } + + public void testParameterizedType2() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + IPath usePath = env.addClass(projectPath, "p", "Use", + "package p;\n" + + "import java.util.ArrayList;\n" + + "import q.Other;\n" + + "public class Use {\n" + + " public Use() {\n" + + " new Other().foo(new ArrayList());\n" + + " }\n" + + "}" + ); + env.addClass(projectPath, "q", "Other", + "package q;\n" + + "import java.util.List;\n" + + "public class Other {\n" + + " public void foo(List ls) {}\n" + + "}" + ); + + fullBuild(projectPath); + expectingNoProblems(); + + env.addClass(projectPath, "q", "Other", + "package q;\n" + + "import java.util.List;\n" + + "public class Other {\n" + + " public void foo(List ls) throws Exception {}\n" + + "}" + ); + + incrementalBuild(projectPath); + expectingProblemsFor( + usePath, + "Problem : Unhandled exception type Exception [ resource : range : <92,132> category : <40> severity : <2>]" + ); + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057 + public void testHierarchyNonCycle() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + env.addClass(projectPath, "superint", "SuperInterface", + "package superint;\n" + + "public interface SuperInterface {\n" + + " public interface SuperInterfaceGetter {}\n" + + " public interface SuperInterfaceSetter {}\n" + + "}\n" + ); + env.addClass(projectPath, "subint", "SubInterface", + "package subint;\n" + + "import superint.SuperInterface;\n" + + "public interface SubInterface extends\n" + + " SuperInterface {\n" + + " public interface SubInterfaceGetter extends SuperInterfaceGetter {}\n" + + " public interface SubInterfaceSetter extends SuperInterfaceSetter {}\n" + + "}\n" + ); + + fullBuild(projectPath); + expectingProblemsFor( + projectPath, + "Problem : Bound mismatch: The type SubInterface.SubInterfaceGetter is not a valid substitute for the bounded parameter of the type SuperInterface [ resource : range : <105,136> category : <40> severity : <2>]\n" + + "Problem : Bound mismatch: The type SubInterface.SubInterfaceSetter is not a valid substitute for the bounded parameter of the type SuperInterface [ resource : range : <157,188> category : <40> severity : <2>]\n" + + "Problem : SuperInterfaceGetter cannot be resolved to a type [ resource : range : <244,264> category : <40> severity : <2>]\n" + + "Problem : SuperInterfaceSetter cannot be resolved to a type [ resource : range : <320,340> category : <40> severity : <2>]" + ); + } + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=294057 (variation) + public void testHierarchyNonCycle2() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.setOutputFolder(projectPath, ""); + + env.addClass(projectPath, "superint", "SuperInterface", + "package superint;\n" + + "public interface SuperInterface {\n" + + " public interface SuperInterfaceGetter {}\n" + + " public interface SuperInterfaceSetter {}\n" + + "}\n" + ); + env.addClass(projectPath, "subint", "SubInterface", + "package subint;\n" + + "import superint.SuperInterface;\n" + + "import superint.SuperInterface.SuperInterfaceGetter;\n" + + "import superint.SuperInterface.SuperInterfaceSetter;\n" + + "public interface SubInterface extends\n" + + " SuperInterface {\n" + + " public interface SubInterfaceGetter extends SuperInterfaceGetter {}\n" + + " public interface SubInterfaceSetter extends SuperInterfaceSetter {}\n" + + "}\n" + ); + + fullBuild(projectPath); + expectingNoProblems(); + } + +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsAfter9.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsAfter9.java new file mode 100644 index 0000000000..f9c569a8bf --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsAfter9.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2019, 2021 Andrey Loskutov 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: + * Andrey Loskutov - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; + +import junit.framework.Test; + +public class LeakTestsAfter9 extends AbstractLeakTest { + + public LeakTestsAfter9(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(LeakTestsAfter9.class); + } + + String getCompatibilityLevel() { + return CompilerOptions.VERSION_9; + } + + @Override + public void testLeaksOnCleanBuild() throws Exception { + super.testLeaksOnCleanBuild(); + } + + @Override + public void testLeaksOnFullBuild() throws Exception { + super.testLeaksOnFullBuild(); + } + + @Override + public void testLeaksOnIncrementalBuild() throws Exception { + super.testLeaksOnIncrementalBuild(); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsBefore9.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsBefore9.java new file mode 100644 index 0000000000..f3a837f3bd --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/LeakTestsBefore9.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2019, 2021 Andrey Loskutov 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: + * Andrey Loskutov - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; + +import junit.framework.Test; + +public class LeakTestsBefore9 extends AbstractLeakTest { + + public LeakTestsBefore9(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(LeakTestsBefore9.class); + } + + String getCompatibilityLevel() { + return CompilerOptions.VERSION_1_4; + } + + @Override + public void testLeaksOnCleanBuild() throws Exception { + super.testLeaksOnCleanBuild(); + } + + @Override + public void testLeaksOnFullBuild() throws Exception { + super.testLeaksOnFullBuild(); + } + + @Override + public void testLeaksOnIncrementalBuild() throws Exception { + super.testLeaksOnIncrementalBuild(); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java new file mode 100644 index 0000000000..dba4ad0878 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiProjectTests.java @@ -0,0 +1,2211 @@ +/******************************************************************************* + * Copyright (c) 2000, 2019 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * 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.builder; + +import java.util.Hashtable; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IAccessRule; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.test.OrderedTestSuite; + +import junit.framework.Test; + + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class MultiProjectTests extends BuilderTests { + + public MultiProjectTests(String name) { + super(name); + } + + public static Test suite() { + return new OrderedTestSuite(MultiProjectTests.class); + } + + public void testCompileOnlyDependent() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B extends A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath project3Path = env.addProject("Project3"); //$NON-NLS-1$ + env.addExternalJars(project3Path, Util.getJavaClassLibs()); + IPath root3 = env.getPackageFragmentRootPath(project3Path, ""); //$NON-NLS-1$ + env.addClass(root3, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + " int x;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + expectingCompiledClasses(new String[]{"A", "B"}); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); + } + + // 14103 - avoid recompiling unaffected sources in dependent projects + public void testCompileOnlyStructuralDependent() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "", "Unreferenced", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Unreferenced {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B extends A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath project3Path = env.addProject("Project3"); //$NON-NLS-1$ + env.addExternalJars(project3Path, Util.getJavaClassLibs()); + IPath root3 = env.getPackageFragmentRootPath(project3Path, ""); //$NON-NLS-1$ + env.addClass(root3, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + // non-structural change should not fool dependent projcts + env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + " // add comment (non-structural change)\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + // structural change, but no actual dependents + env.addClass(root1, "", "Unreferenced", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Unreferenced {\n"+ //$NON-NLS-1$ + " int x; //structural change\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + expectingCompiledClasses(new String[]{"A", "Unreferenced"}); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); + } + + public void testRemoveField() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + options.put(JavaCore.COMPILER_PB_UNUSED_LOCAL, JavaCore.IGNORE); + JavaCore.setOptions(options); + + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + " public int x;\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + IPath b = env.addClass(root2, "", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {\n"+ //$NON-NLS-1$ + " public void foo(){\n"+ //$NON-NLS-1$ + " int x = new A().x;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.addClass(root1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + incrementalBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(b, new Problem("B.foo()", "x cannot be resolved or is not a field", b, 61, 62, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + public void testCompileOrder() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + IPath c1 = env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " W w;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + IPath c2 = env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y {\n"+ //$NON-NLS-1$ + " W w;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + IPath c3 = env.addClass(root3, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + " W w;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.setBuildOrder(new String[]{"P1", "P3", "P2"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P3/src/p3/Z.java", "/P2/src/p2/Y.java" }); + IPath workspaceRootPath = env.getWorkspaceRootPath(); + expectingOnlySpecificProblemsFor(workspaceRootPath,new Problem[]{ + new Problem("p3", "W cannot be resolved to a type", c3, 31, 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", "W cannot be resolved to a type", c2, 31, 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p1", "W cannot be resolved to a type", c1, 31, 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)//$NON-NLS-1$ //$NON-NLS-2$ + }); + JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } + + public void testCyclesCleared() throws JavaModelException { + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + try { + env.addRequiredProject(p1, p2); + env.addRequiredProject(p2, p1); + + fullBuild(); + env.waitForAutoBuild(); + + printProblems(); + expectingOnlySpecificProblemsFor(p1, new Problem[] { + new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + new Problem("p1", + "The project cannot be built until build path errors are resolved", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) + }); + expectingOnlySpecificProblemsFor(p2, new Problem[] { + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + new Problem("p2", + "The project cannot be built until build path errors are resolved", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR) + }); + + env.removeRequiredProject(p1, p2); + + fullBuild(); + env.waitForAutoBuild(); + + expectingNoProblems(); + } finally { + env.removeProject(p1); + env.removeProject(p2); + } + } + + public void testCycle1() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "import p2.Y;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " public void bar(Y y){\n"+ //$NON-NLS-1$ + " y.zork();\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "import p3.Z;\n"+ //$NON-NLS-1$ + "public class Y extends Z{\n"+ //$NON-NLS-1$ + " public X zork(){\n"+ //$NON-NLS-1$ + " X x = foo();\n"+ //$NON-NLS-1$ + " x.bar(this);\n"+ //$NON-NLS-1$ + " return x;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + env.addClass(root3, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + " public X foo(){\n"+ //$NON-NLS-1$ + " return null;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // for Project1 + env.addRequiredProject(p1, p2); + env.addRequiredProject(p1, p3); + // for Project2 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p2, p3); + // for Project3 + env.addRequiredProject(p3, p1); + + try { + env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P1/src/p1/X.java", "/P3/src/p3/Z.java" }); + expectingOnlySpecificProblemFor(p1, new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemFor(p2,new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemFor(p3,new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + + JavaCore.setOptions(options); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } + } + + public void testCycle2() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "import p2.Y;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " public void bar(Y y, int i){\n"+ //$NON-NLS-1$ + " y.zork();\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + IPath c2 = env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "import p3.Z;\n"+ //$NON-NLS-1$ + "public class Y extends Z{\n"+ //$NON-NLS-1$ + " public X zork(){\n"+ //$NON-NLS-1$ + " X x = foo();\n"+ //$NON-NLS-1$ + " x.bar(this);\n"+ //$NON-NLS-1$ + " return x;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + env.addClass(root3, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + " public X foo(){\n"+ //$NON-NLS-1$ + " return null;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // for Project1 + env.addRequiredProject(p1, p2); + env.addRequiredProject(p1, p3); + // for Project2 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p2, p3); + // for Project3 + env.addRequiredProject(p3, p1); + + try { + env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P1/src/p1/X.java", "/P3/src/p3/Z.java" }); + expectingOnlySpecificProblemFor(p1,new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemsFor(p2,new Problem[]{ + new Problem("p2", "The method bar(Y, int) in the type X is not applicable for the arguments (Y)", c2, 106, 109, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemFor(p3,new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + + JavaCore.setOptions(options); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } + } + + public void testCycle3() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "import p2.Y;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " public void bar(Y y){\n"+ //$NON-NLS-1$ + " y.zork();\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + IPath c2 = env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "import p3.Z;\n"+ //$NON-NLS-1$ + "public class Y extends Z{\n"+ //$NON-NLS-1$ + " public X zork(){\n"+ //$NON-NLS-1$ + " X x = foo();\n"+ //$NON-NLS-1$ + " x.bar(this);\n"+ //$NON-NLS-1$ + " return x;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + env.addClass(root3, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + " public X foo(){\n"+ //$NON-NLS-1$ + " return null;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // for Project1 + env.addRequiredProject(p1, p2); + env.addRequiredProject(p1, p3); + // for Project2 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p2, p3); + // for Project3 + env.addRequiredProject(p3, p1); + + try { + env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P1/src/p1/X.java", "/P3/src/p3/Z.java" }); + expectingOnlySpecificProblemFor(p1,new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemFor(p2,new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemFor(p3,new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "import p2.Y;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " public void bar(Y y, int i){\n"+ //$NON-NLS-1$ + " y.zork();\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(); + env.waitForAutoBuild(); + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java" }); + expectingOnlySpecificProblemFor(p1,new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemsFor(p2,new Problem[]{ + new Problem("p2", "The method bar(Y, int) in the type X is not applicable for the arguments (Y)", c2, 106, 109, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemFor(p3,new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + + JavaCore.setOptions(options); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } + } + public void testCycle4() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + IPath c2 = env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "import p3.Z;\n"+ //$NON-NLS-1$ + "public class Y extends Z{\n"+ //$NON-NLS-1$ + " public X zork(){\n"+ //$NON-NLS-1$ + " X x = foo();\n"+ //$NON-NLS-1$ + " x.bar(this);\n"+ //$NON-NLS-1$ + " return x;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + IPath c3 = env.addClass(root3, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "import p1.X;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + " public X foo(){\n"+ //$NON-NLS-1$ + " return null;\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // for Project1 + env.addRequiredProject(p1, p2); + env.addRequiredProject(p1, p3); + // for Project2 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p2, p3); + // for Project3 + env.addRequiredProject(p3, p1); + + try { + env.setBuildOrder(new String[]{"P1", "P2", "P3"});//$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$ + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + + expectingCompilingOrder(new String[] { "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", "/P2/src/p2/Y.java" }); + expectingOnlySpecificProblemFor(p1,new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemsFor(p2,new Problem[]{ + new Problem("p2", "X cannot be resolved to a type", c2, 87, 88, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", "The method foo() from the type Z refers to the missing type X", c2, 93, 96, CategorizedProblem.CAT_MEMBER, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", "The import p1 cannot be resolved", c2, 19, 21, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", "X cannot be resolved to a type", c2, 73, 74, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemsFor(p3,new Problem[]{ + new Problem("p3", "X cannot be resolved to a type", c3, 51, 52, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p3", "The import p1 cannot be resolved", c3, 19, 21, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + + env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "import p2.Y;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + " public void bar(Y y){\n"+ //$NON-NLS-1$ + " y.zork();\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + incrementalBuild(); + env.waitForAutoBuild(); + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P3/src/p3/Z.java", + "/P1/src/p1/X.java", "/P2/src/p2/Y.java" }); + expectingOnlySpecificProblemFor(p1,new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemFor(p2,new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + expectingOnlySpecificProblemFor(p3,new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING)); + + JavaCore.setOptions(options); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } + } + + public void testCycle5() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); // $NON-NLS-1$ + + JavaCore.setOptions(newOptions); + + // ---------------------------- + // Project1 + // ---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + IPath c1 = env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "import p2.*;\n" + //$NON-NLS-1$ + "import p22.*;\n" + //$NON-NLS-1$ + "public class X {\n" + //$NON-NLS-1$ + " Y y;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // ---------------------------- + // Project2 + // ---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + IPath c2 = env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + //$NON-NLS-1$ + "import p1.*;\n" + //$NON-NLS-1$ + "import p11.*;\n" + //$NON-NLS-1$ + "public class Y {\n" + //$NON-NLS-1$ + " X x;\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + // for Project1 + env.addRequiredProject(p1, p2); + // for Project2 + env.addRequiredProject(p2, p1); + + try { + env.setBuildOrder(new String[] { "P1", "P2" });//$NON-NLS-1$ //$NON-NLS-2$ + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + + expectingCompilingOrder(new String[] { "/P1/src/p1/X.java", "/P2/src/p2/Y.java", "/P1/src/p1/X.java", + "/P2/src/p2/Y.java" }); + expectingOnlySpecificProblemsFor(p1, new Problem[] { + new Problem("p1", "The import p22 cannot be resolved", c1, 32, 35, CategorizedProblem.CAT_IMPORT, //$NON-NLS-1$ //$NON-NLS-2$ + IMarker.SEVERITY_ERROR), new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); + expectingOnlySpecificProblemsFor(p2, new Problem[] { + new Problem("p2", "The import p11 cannot be resolved", c2, 32, 35, CategorizedProblem.CAT_IMPORT, //$NON-NLS-1$ //$NON-NLS-2$ + IMarker.SEVERITY_ERROR), new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); + + env.addClass(root1, "p11", "XX", //$NON-NLS-1$ //$NON-NLS-2$ + "package p11;\n" + //$NON-NLS-1$ + "public class XX {\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root2, "p22", "YY", //$NON-NLS-1$ //$NON-NLS-2$ + "package p22;\n" + //$NON-NLS-1$ + "public class YY {\n" + //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingCompilingOrder(new String[] { "/P1/src/p11/XX.java", "/P2/src/p22/YY.java", "/P2/src/p2/Y.java", + "/P1/src/p1/X.java" }); + expectingOnlySpecificProblemsFor(p1, new Problem[] { + new Problem("p1", "The import p22 is never used", c1, 32, 35, //$NON-NLS-1$ //$NON-NLS-2$ + CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), new Problem("p1", //$NON-NLS-1$ + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); + expectingOnlySpecificProblemsFor(p2, new Problem[] { + new Problem("p2", "The import p11 is never used", c2, 32, 35, //$NON-NLS-1$ //$NON-NLS-2$ + CategorizedProblem.CAT_UNNECESSARY_CODE, IMarker.SEVERITY_WARNING), new Problem("p2", //$NON-NLS-1$ + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) }); + + JavaCore.setOptions(options); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + } + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349 +// this one fails; compare with testCycle7 (only one change in Object source), +// which passes +public void testCycle6() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); + IPath root1 = env.addPackageFragmentRoot(p1, "src"); + env.setOutputFolder(p1, "bin"); + + env.addClass(root1, "java/lang", "Object", + "package java.lang;\n" + + "public class Object {\n" + + " Class getClass() { return null; }\n" + + " String toString() { return \"\"; }\n" + // the line that changes + "}\n" + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); + IPath root2 = env.addPackageFragmentRoot(p2, "src"); + env.setOutputFolder(p2, "bin"); + + env.addClass(root2, "java/lang", "Class", + "package java.lang;\n" + + "public class Class {\n" + + " String getName() { return \"\"; };\n" + + "}\n" + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); + IPath root3 = env.addPackageFragmentRoot(p3, "src"); + env.setOutputFolder(p3, "bin"); + + env.addClass(root3, "java/lang", "String", + "package java.lang;\n" + + "public class String {\n" + + "}\n" + ); + + // Dependencies + IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")}; + IPath[] forbiddenPaths = new IPath[] {new Path("**/*")}; + env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemsFor(p1,new Problem[]{ + new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "P1->{P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemsFor(p2,new Problem[]{ + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemsFor(p3,new Problem[]{ + new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + + } finally { + JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=114349 +// this one passes; compare with testCycle6 (only one change in Object source), +// which fails +public void testCycle7() throws JavaModelException { + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); + IPath root1 = env.addPackageFragmentRoot(p1, "src"); + env.setOutputFolder(p1, "bin"); + + env.addClass(root1, "java/lang", "Object", + "package java.lang;\n" + + "public class Object {\n" + + " Class getClass() { return null; }\n" + + " String toString() { return null; }\n" + // the line that changes + "}\n" + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); + IPath root2 = env.addPackageFragmentRoot(p2, "src"); + env.setOutputFolder(p2, "bin"); + + env.addClass(root2, "java/lang", "Class", + "package java.lang;\n" + + "public class Class {\n" + + " String getName() { return \"\"; };\n" + + "}\n" + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); + IPath root3 = env.addPackageFragmentRoot(p3, "src"); + env.setOutputFolder(p3, "bin"); + + env.addClass(root3, "java/lang", "String", + "package java.lang;\n" + + "public class String {\n" + + "}\n" + ); + + // Dependencies + IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")}; + IPath[] forbiddenPaths = new IPath[] {new Path("**/*")}; + env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p1, p3, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p2, p1, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p3, p1, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p3, p2, accessiblePaths, forbiddenPaths, false); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemsFor(p1,new Problem[]{ + new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "P1->{P2, P3}\n" + + "->{P1, P3}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemsFor(p2,new Problem[]{ + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2}\n" + + "->{P1, P2, P3}\n" + + "->{P2, P3}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemsFor(p3,new Problem[]{ + new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P1, P2, P3}\n" + + "->{P2, P3}\n" + + "->{P1, P3}", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + + } finally { + JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } +} + public void testCycle8() throws JavaModelException { + // specifically tests projects with (transitive) dependencies on a cycle, i.e., error messages with a non-empty prefix + Hashtable options = JavaCore.getOptions(); + Hashtable newOptions = JavaCore.getOptions(); + newOptions.put(JavaCore.CORE_CIRCULAR_CLASSPATH, JavaCore.WARNING); + + JavaCore.setOptions(newOptions); + + IPath p1 = env.addProject("P1"); + IPath p2 = env.addProject("P2"); + IPath p3 = env.addProject("P3"); + IPath p4 = env.addProject("P4"); + + // Dependencies + IPath[] accessiblePaths = new IPath[] {new Path("java/lang/*")}; + IPath[] forbiddenPaths = new IPath[] {new Path("**/*")}; + env.addRequiredProject(p1, p2, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p2, p3, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p3, p4, accessiblePaths, forbiddenPaths, false); + env.addRequiredProject(p4, p3, accessiblePaths, forbiddenPaths, false); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemsFor(p1,new Problem[]{ + new Problem("p1", + "One or more cycles were detected in the build path of project 'P1'. The paths towards the cycle and cycle are:\n" + + "P1, P2->{P3, P4}", + p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + expectingOnlySpecificProblemsFor(p2,new Problem[]{ + new Problem("p2", + "One or more cycles were detected in the build path of project 'P2'. The paths towards the cycle and cycle are:\n" + + "P2->{P3, P4}", + p2, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING), + }); + expectingOnlySpecificProblemsFor(p3,new Problem[]{ + new Problem("p3", + "One or more cycles were detected in the build path of project 'P3'. The paths towards the cycle and cycle are:\n" + + "->{P3, P4}", + p3, -1,-1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_WARNING) + }); + + } finally { + JavaCore.setOptions(options); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + env.removeProject(p4); + } + } + + /* + * Full buid case + */ + public void testExcludePartOfAnotherProject1() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p.api", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.api;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "p.internal", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.internal;\n" + //$NON-NLS-1$ + "public class B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {new Path("**/internal/")}, false); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C extends p.api.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + IPath d = env.addClass(root2, "", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + /* + * Incremental buid case + */ + public void testExcludePartOfAnotherProject2() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p.api", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.api;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "p.internal", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.internal;\n" + //$NON-NLS-1$ + "public class B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {new Path("**/internal/")}, false); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C extends p.api.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + IPath d = env.addClass(root2, "", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + /* + * Fix access restriction problem + */ + public void testExcludePartOfAnotherProject3() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p.api", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.api;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "p.internal", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.internal;\n" + //$NON-NLS-1$ + "public class B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {new Path("**/internal/")}, false); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C extends p.api.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + IPath d = env.addClass(root2, "", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + //---------------------------- + // Step 2 + //---------------------------- + env.removeRequiredProject(project2Path, project1Path); + env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {}, false); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + /* + * Full buid case + */ + public void testIncludePartOfAnotherProject1() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p.api", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.api;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "p.internal", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.internal;\n" + //$NON-NLS-1$ + "public class B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, new IPath[] {new Path("**/api/")}, new IPath[] {new Path("**")}, false); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C extends p.api.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + IPath d = env.addClass(root2, "", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + /* + * Incremental buid case + */ + public void testIncludePartOfAnotherProject2() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p.api", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.api;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "p.internal", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.internal;\n" + //$NON-NLS-1$ + "public class B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, new IPath[] {new Path("**/api/")}, new IPath[] {new Path("**")}, false); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C extends p.api.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + IPath d = env.addClass(root2, "", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + /* + * Fix access restriction problem + */ + public void testIncludePartOfAnotherProject3() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p.api", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.api;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.addClass(root1, "p.internal", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.internal;\n" + //$NON-NLS-1$ + "public class B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path, new IPath[] {new Path("**/api/")}, new IPath[] {new Path("**")}, false); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C extends p.api.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + IPath d = env.addClass(root2, "", "D", //$NON-NLS-1$ //$NON-NLS-2$ + "public class D extends p.internal.B {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project2Path, new Problem("", "Access restriction: The type 'B' is not API (restriction on required project 'Project1')", d, 23, 35, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + + //---------------------------- + // Step 2 + //---------------------------- + env.removeRequiredProject(project2Path, project1Path); + env.addRequiredProject(project2Path, project1Path, new IPath[] {}, new IPath[] {}, false); + + incrementalBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); + } + + /* + * Ensures that a type matching a ignore-if-better non-accessible rule is further found when accessible + * on another classpath entry. + * (regression test for bug 98127 Access restrictions started showing up after switching to bundle) + */ + public void testIgnoreIfBetterNonAccessibleRule1() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath project3Path = env.addProject("Project3"); //$NON-NLS-1$ + env.addExternalJars(project3Path, Util.getJavaClassLibs()); + env.addRequiredProject(project3Path, project1Path, new Path("**/p/"), IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER); + env.addRequiredProject(project3Path, project2Path, new Path("**/p/A"), IAccessRule.K_ACCESSIBLE); + IPath root3 = env.getPackageFragmentRootPath(project3Path, ""); //$NON-NLS-1$ + env.addClass(root3, "p3", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n" + //$NON-NLS-1$ + "public class B extends p.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); + } + + /* + * Ensures that a type matching a ignore-if-better non-accessible rule is further found when accessible + * on another classpath entry. + * (regression test for bug 98127 Access restrictions started showing up after switching to bundle) + */ + public void testIgnoreIfBetterNonAccessibleRule2() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath project1Path = env.addProject("Project1"); //$NON-NLS-1$ + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + IPath root1 = env.getPackageFragmentRootPath(project1Path, ""); //$NON-NLS-1$ + env.addClass(root1, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath project2Path = env.addProject("Project2"); //$NON-NLS-1$ + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + IPath root2 = env.getPackageFragmentRootPath(project2Path, ""); //$NON-NLS-1$ + env.addClass(root2, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + //$NON-NLS-1$ + "public class A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath project3Path = env.addProject("Project3"); //$NON-NLS-1$ + env.addExternalJars(project3Path, Util.getJavaClassLibs()); + env.addRequiredProject(project3Path, project1Path, new Path("**/p/"), IAccessRule.K_NON_ACCESSIBLE | IAccessRule.IGNORE_IF_BETTER); + env.addRequiredProject(project3Path, project2Path, new Path("**/p/A"), IAccessRule.K_DISCOURAGED); + IPath root3 = env.getPackageFragmentRootPath(project3Path, ""); //$NON-NLS-1$ + IPath b = env.addClass(root3, "p3", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n" + //$NON-NLS-1$ + "public class B extends p.A {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemFor(project3Path, new Problem("", "Discouraged access: The type 'A' is not API (restriction on required project 'Project2')", b, 35, 38, CategorizedProblem.CAT_RESTRICTION, IMarker.SEVERITY_WARNING)); //$NON-NLS-1$ //$NON-NLS-2$ + env.removeProject(project1Path); + env.removeProject(project2Path); + env.removeProject(project3Path); + } + + public void testMissingRequiredBinaries() throws JavaModelException { + + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.addRequiredProject(p1, p2); + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.addRequiredProject(p2, p3); + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + IPath x = env.addClass(root1, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "import p2.*;\n"+ //$NON-NLS-1$ + "public class X extends Y{\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "import p3.*;\n"+ //$NON-NLS-1$ + "public class Y extends Z {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(root3, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class Z {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + + expectingOnlySpecificProblemsFor(p1,new Problem[]{ + new Problem("p1", "The type p3.Z cannot be resolved. It is indirectly referenced from required .class files", x, 48, 49, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR),//$NON-NLS-1$ //$NON-NLS-2$ + new Problem("p1", "The project was not built since its build path is incomplete. Cannot find the class file for p3.Z. Fix the build path then try building this project", p1, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR)//$NON-NLS-1$ //$NON-NLS-2$ + }); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p1); + env.removeProject(p3); + } + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159118 +// contrast this with test101: get an error when the class folder is not +// exported from the target project - P1 here +public void test100_class_folder_exported() throws JavaModelException { + IPath P1 = env.addProject("P1"); + env.setOutputFolder(P1, "bin"); + env.addExternalJars(P1, Util.getJavaClassLibs()); + env.addClass( + env.addPackage( + env.getPackageFragmentRootPath(P1, ""), "p"), + "A", + "package p;\n" + + "public class A {\n" + + "}\n" + ); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removePackageFragmentRoot(P1, ""); + env.addClassFolder(P1, P1.append("bin"), true); + IPath P2 = env.addProject("P2"); + env.addExternalJars(P2, Util.getJavaClassLibs()); + env.addRequiredProject(P2, P1); + env.addClass( + env.getPackageFragmentRootPath(P2, ""), + "X", + "import p.A;\n" + + "public class X {\n" + + " A f;\n" + + "}"); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.removeProject(P1); + env.removeProject(P2); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159118 +// contrast this with test100: get an error when the class folder is not +// exported from the target project - P1 here +public void test101_class_folder_non_exported() throws JavaModelException { + IPath P1 = env.addProject("P1"); + env.setOutputFolder(P1, "bin"); + env.addExternalJars(P1, Util.getJavaClassLibs()); + env.addClass( + env.addPackage( + env.getPackageFragmentRootPath(P1, ""), "p"), + "A", + "package p;\n" + + "public class A {\n" + + "}\n" + ); + fullBuild(); + expectingNoProblems(); + env.removePackageFragmentRoot(P1, ""); + env.addClassFolder(P1, P1.append("bin"), false); + IPath P2 = env.addProject("P2"); + env.addExternalJars(P2, Util.getJavaClassLibs()); + env.addRequiredProject(P2, P1); + IPath c = env.addClass( + env.getPackageFragmentRootPath(P2, ""), + "X", + "import p.A;\n" + + "public class X {\n" + + " A f;\n" + + "}"); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingSpecificProblemsFor(P2, + new Problem[] { + new Problem("", "The import p cannot be resolved", + c, 7 , 8, CategorizedProblem.CAT_IMPORT, IMarker.SEVERITY_ERROR), + new Problem("", "A cannot be resolved to a type", + c, 31 , 32, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)}); + env.removeProject(P1); + env.removeProject(P2); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=164622 +public void test102_missing_required_binaries() throws JavaModelException { + + IPath p1 = env.addProject("P1"); + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); + IPath root1 = env.addPackageFragmentRoot(p1, "src"); + env.setOutputFolder(p1, "bin"); + + IPath p2 = env.addProject("P2"); + env.addExternalJars(p2, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p2, ""); + IPath root2 = env.addPackageFragmentRoot(p2, "src"); + env.addRequiredProject(p2, p1); + env.setOutputFolder(p2, "bin"); + + IPath p3 = env.addProject("P3"); + env.addExternalJars(p3, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p3, ""); + IPath root3 = env.addPackageFragmentRoot(p3, "src"); +// env.addRequiredProject(p3, p1); - missing dependency + env.addRequiredProject(p3, p2); + env.setOutputFolder(p3, "bin"); + + env.addClass(root1, "", "I", + "public interface I {\n" + + "}\n" + ); + + env.addClass(root2, "", "X", + "public class X implements I {\n" + + "}\n" + ); + + IPath y = env.addClass(root3, "", "Y", + "public class Y extends X {\n" + + " X m = new X() {};\n" + + "}\n" + ); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemsFor(p3, new Problem[]{ + new Problem("p3", + "The project was not built since its build path is incomplete. Cannot find the class file for I. Fix the build path then try building this project", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + new Problem("p3", + "The type I cannot be resolved. It is indirectly referenced from required .class files", + y, 23, 24, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + }); + } finally { + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=164622 +public void test103_missing_required_binaries() throws JavaModelException { + + IPath p1 = env.addProject("P1"); + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); + IPath root1 = env.addPackageFragmentRoot(p1, "src"); + env.setOutputFolder(p1, "bin"); + + IPath p2 = env.addProject("P2"); + env.addExternalJars(p2, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p2, ""); + IPath root2 = env.addPackageFragmentRoot(p2, "src"); + env.addRequiredProject(p2, p1); + env.setOutputFolder(p2, "bin"); + + IPath p3 = env.addProject("P3"); + env.addExternalJars(p3, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p3, ""); + IPath root3 = env.addPackageFragmentRoot(p3, "src"); +// env.addRequiredProject(p3, p1); - missing dependency + env.addRequiredProject(p3, p2); + env.setOutputFolder(p3, "bin"); + + env.addClass(root1, "", "I", + "public interface I {\n" + + "}\n" + ); + + env.addClass(root2, "", "X", + "public class X implements I {\n" + + "}\n" + ); + + IPath y = env.addClass(root3, "", "Y", + "public class Y {\n" + + " X m = new X() {};\n" + + " X n = new X() {};\n" + + "}\n" + ); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemsFor(p3, new Problem[]{ + new Problem("p3", + "The project was not built since its build path is incomplete. Cannot find the class file for I. Fix the build path then try building this project", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + new Problem("p3", + "The type I cannot be resolved. It is indirectly referenced from required .class files", + y, 0, 1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + }); + } finally { + env.setBuildOrder(null); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); + } +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=460993 +public void test104_missing_required_binaries() throws CoreException { + + IPath p0 = env.addProject("JRE17", "1.7"); + env.addExternalJars(p0, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p0, ""); + IPath root0 = env.addPackageFragmentRoot(p0, "src"); + env.setOutputFolder(p0, "bin"); + + IPath p1 = env.addProject("org.eclipse.jgit", "1.7"); + env.addExternalJars(p1, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p1, ""); + IPath root1 = env.addPackageFragmentRoot(p1, "src"); + env.addRequiredProject(p1, p0); + env.setOutputFolder(p1, "bin"); + + IPath p2 = env.addProject("org.eclipse.releng.tools", "1.5"); + env.addExternalJars(p2, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(p2, ""); + IPath root2 = env.addPackageFragmentRoot(p2, "src"); +// env.addRequiredProject(p2, p0); - missing dependency + env.addRequiredProject(p2, p1); + env.setOutputFolder(p2, "bin"); + + env.addClass(root0, "jre17", "AutoClosable", + "package jre17;\n" + + "public interface AutoClosable {\n" + + " void closeIt();\n" + + "}\n" + ); + + env.addClass(root1, "org.eclipse.jgit.lib", "Repository", + "package org.eclipse.jgit.lib;\n" + + "import jre17.AutoClosable;\n" + + "public abstract class Repository implements AutoClosable {\n" + + " public void resolve(final String revstr) { }\n" + + "}\n" + ); + + IPath gca = env.addClass(root2, "org.eclipse.releng.tools.git", "GitCopyrightAdapter", + "package org.eclipse.releng.tools.git;\n" + + "import org.eclipse.jgit.lib.Repository;\n" + + "public class GitCopyrightAdapter {\n" + + " void foo(Repository repo) {\n" + + " repo.resolve(\"Head\");\n" + + " }\n" + + "}\n" + ); + env.addClass(root2, "org.eclipse.releng.tools.preferences", "Messages", + "package org.eclipse.releng.tools.preferences;\n" + + "final class Messages {\n" + + " {\n" + + " @SuppressWarnings(\"unused\")\n" + + " Object o = \"\"; // triggers the bug\n" + + " }\n" + + "}\n" + ); + + try { + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + + IFile gcaFile = (IFile) env.getWorkspace().getRoot().findMember(gca); + gcaFile.touch(null); + env.waitForManualRefresh(); + incrementalBuild(p2); + env.waitForAutoBuild(); + expectingNoProblems(); + + } finally { + env.setBuildOrder(null); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p0); + } +} + + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=438923, [compiler]Type is inappropriately considered "indirectly referenced" +public void test438923() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("P1"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "p1", "P1I0", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + + "public interface P1I0 {\n" + + " interface II {/*empty*/}\n" + + "}\n" + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("P2"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "p2", "P2C0", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n" + + "import p1.P1I0;\n" + + "public class P2C0 {\n" + + " public void z(final P1I0.II [] ii) {/*empty*/}\n" + + "}\n" + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("P3"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + env.addClass(root3, "p3", "P3C0", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n" + + "import p2.P2C0;\n" + + "public class P3C0\n" + + " extends P2C0 {/*empty*/}\n" + ); + + // for Project1 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p3, p2); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=461074, "indirectly referenced from required .class files" error for unreachable reference of type in overriding method declaration in a library on classpath +public void test461074() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("SampleMissing"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "pack.missing", "MissingType", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.missing;\n" + + "public class MissingType {\n" + + "}\n" + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("SampleLib", "1.5"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "pack.lib", "TopClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.lib;\n" + + "public class TopClass {\n" + + " Object get() { return null; }\n" + + "}\n" + ); + env.addClass(root2, "pack.lib", "SuperClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.lib;\n" + + "import pack.missing.MissingType;\n" + + "public class SuperClass extends TopClass {\n" + + " @Override\n" + + " MissingType get() { return null; }\n" + + "}\n" + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("SampleTest", "1.5"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + env.addClass(root3, "pack.test", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.test;\n" + + "import pack.lib.SuperClass;\n" + + "public class Test extends SuperClass {/*empty*/}\n" + ); + + // for Project1 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p3, p2); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingNoProblems(); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=461074, "indirectly referenced from required .class files" error for unreachable reference of type in overriding method declaration in a library on classpath +public void test461074_error() throws JavaModelException { + //---------------------------- + // Project1 + //---------------------------- + IPath p1 = env.addProject("SampleMissing"); //$NON-NLS-1$ + env.addExternalJars(p1, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p1, ""); //$NON-NLS-1$ + IPath root1 = env.addPackageFragmentRoot(p1, "src"); //$NON-NLS-1$ + env.setOutputFolder(p1, "bin"); //$NON-NLS-1$ + + env.addClass(root1, "pack.missing", "MissingType", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.missing;\n" + + "public class MissingType {\n" + + "}\n" + ); + + //---------------------------- + // Project2 + //---------------------------- + IPath p2 = env.addProject("SampleLib", "1.5"); //$NON-NLS-1$ + env.addExternalJars(p2, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p2, ""); //$NON-NLS-1$ + IPath root2 = env.addPackageFragmentRoot(p2, "src"); //$NON-NLS-1$ + env.setOutputFolder(p2, "bin"); //$NON-NLS-1$ + + env.addClass(root2, "pack.lib", "TopClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.lib;\n" + + "public abstract class TopClass {\n" + + " abstract Object get();\n" + + "}\n" + ); + env.addClass(root2, "pack.lib", "SuperClass", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.lib;\n" + + "import pack.missing.MissingType;\n" + + "public class SuperClass extends TopClass {\n" + + " @Override\n" + + " MissingType get() { return null; }\n" + + "}\n" + ); + + //---------------------------- + // Project3 + //---------------------------- + IPath p3 = env.addProject("SampleTest", "1.5"); //$NON-NLS-1$ + env.addExternalJars(p3, Util.getJavaClassLibs()); + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(p3, ""); //$NON-NLS-1$ + IPath root3 = env.addPackageFragmentRoot(p3, "src"); //$NON-NLS-1$ + env.setOutputFolder(p3, "bin"); //$NON-NLS-1$ + + IPath test = env.addClass(root3, "pack.test", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack.test;\n" + + "import pack.lib.SuperClass;\n" + + "public class Test extends SuperClass {/*empty*/}\n" + ); + + // for Project1 + env.addRequiredProject(p2, p1); + env.addRequiredProject(p3, p2); + env.waitForManualRefresh(); + fullBuild(); + env.waitForAutoBuild(); + expectingOnlySpecificProblemsFor(p3, new Problem[]{ + new Problem("p3", + "The project was not built since its build path is incomplete. Cannot find the class file for pack.missing.MissingType. Fix the build path then try building this project", + p3, -1, -1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + new Problem("p3", + "The type pack.missing.MissingType cannot be resolved. It is indirectly referenced from required .class files", + test, 0, 1, CategorizedProblem.CAT_BUILDPATH, IMarker.SEVERITY_ERROR), + }); + env.setBuildOrder(null); + env.removeProject(p1); + env.removeProject(p2); + env.removeProject(p3); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java new file mode 100644 index 0000000000..70a32574b9 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/MultiSourceFolderAndOutputFolderTests.java @@ -0,0 +1,313 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.builder; + +import junit.framework.*; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +/** + * Basic tests of the image builder. + */ +public class MultiSourceFolderAndOutputFolderTests extends BuilderTests { + + public MultiSourceFolderAndOutputFolderTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(MultiSourceFolderAndOutputFolderTests.class); + } + + public void test0001() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "bin1"); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src1, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(projectPath.append("bin1/X.class")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin/X.class")); //$NON-NLS-1$ + } + + public void test0002() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "bin1"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src1, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class X {}" //$NON-NLS-1$ + ); + + env.addClass(src2, "p", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class Y {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(projectPath.append("bin1/p/X.class")); //$NON-NLS-1$ + expectingPresenceOf(projectPath.append("bin/p/Y.class")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin/p/X.class")); //$NON-NLS-1$ + expectingNoPresenceOf(projectPath.append("bin1/p/Y.class")); //$NON-NLS-1$ + } + + public void test0003() { + try { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src", null, null); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src/f1", null, null); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + fullBuild(); + expectingNoProblems(); + + assertTrue("JavaModelException", false); //$NON-NLS-1$ + } catch (JavaModelException e) { + assertEquals( + "Cannot nest 'P/src/f1' inside 'P/src'. " + //$NON-NLS-1$ + "To enable the nesting exclude 'f1/' from 'P/src'", //$NON-NLS-1$ + e.getMessage() + ); + } + } + + public void test0004() { + try { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src/f1", null, null); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src", new IPath[]{new Path("f1")}, null); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + fullBuild(); + expectingNoProblems(); + + assertTrue("JavaModelException", false); //$NON-NLS-1$ + } catch (JavaModelException e) { + assertEquals( + "End exclusion filter 'f1' with / to fully exclude 'P/src/f1'", //$NON-NLS-1$ + e.getMessage() + ); + } + } + + public void test0005() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src/f1", null, null); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src", new IPath[]{new Path("f1/")}, null); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + fullBuild(); + expectingNoProblems(); + } + + public void test0006() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath srcF1 = env.addPackageFragmentRoot(projectPath, "src/f1", null, null); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src", new IPath[]{new Path("f1/")}, null); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class X extends p2.Y{}" //$NON-NLS-1$ + ); + + env.addClass(srcF1, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;"+ //$NON-NLS-1$ + "public class Y {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + } + + public void test0007() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath srcF1 = env.addPackageFragmentRoot(projectPath, "src/f1", null, null); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src", new IPath[]{new Path("f1/")}, null); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath xPath = env.addClass(src, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class X extends f1.p2.Y{}" //$NON-NLS-1$ + ); + + env.addClass(srcF1, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;"+ //$NON-NLS-1$ + "public class Y {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlyProblemsFor(xPath); + } + + public void test0008() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath srcF1 = env.addPackageFragmentRoot(projectPath, "src/f1", null, null); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src", new IPath[]{new Path("f1/")}, null); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath xPath = env.addClass(src, "p", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class X extends p2.Y{}" //$NON-NLS-1$ + ); + + env.addClass(srcF1, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;"+ //$NON-NLS-1$ + "public abstract class Y {"+ //$NON-NLS-1$ + " abstract void foo();"+ //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlyProblemsFor(xPath); + + env.addClass(srcF1, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;"+ //$NON-NLS-1$ + "public class Y {}" //$NON-NLS-1$ + ); + + incrementalBuild(); + + expectingNoProblems(); + } + + public void test0009() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addPackageFragmentRoot(projectPath, "", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addFolder(projectPath, "bin"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {}" //$NON-NLS-1$ + ); + + + fullBuild(); + + expectingNoProblems(); + expectingPresenceOf(projectPath.append("bin2").append("X.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin").append("X.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin2").append("bin")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin").append("bin2")); //$NON-NLS-1$ //$NON-NLS-2$ + } + public void test0010() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addPackageFragmentRoot(projectPath, "", new IPath[]{new Path("src/")}, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + IPath src = env.addPackageFragmentRoot(projectPath, "src", null, null); //$NON-NLS-1$ //$NON-NLS-2$ + env.addFolder(projectPath, "bin"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {}" //$NON-NLS-1$ + ); + + env.addClass(src, "", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Y {}" //$NON-NLS-1$ + ); + + + fullBuild(); + + expectingNoProblems(); + expectingPresenceOf(projectPath.append("bin2").append("X.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin").append("X.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingPresenceOf(projectPath.append("bin").append("Y.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin2").append("Y.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin2").append("bin")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin").append("bin2")); //$NON-NLS-1$ //$NON-NLS-2$ + } + public void test0011() throws JavaModelException { + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addPackageFragmentRoot(projectPath, "", new IPath[]{new Path("src/")}, null); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src = env.addPackageFragmentRoot(projectPath, "src", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addFolder(projectPath, "bin"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(projectPath, "", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "public class X {}" //$NON-NLS-1$ + ); + + env.addClass(src, "", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Y {}" //$NON-NLS-1$ + ); + + + fullBuild(); + + expectingNoProblems(); + expectingPresenceOf(projectPath.append("bin").append("X.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin2").append("X.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingPresenceOf(projectPath.append("bin2").append("Y.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin").append("Y.class")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin2").append("bin")); //$NON-NLS-1$ //$NON-NLS-2$ + expectingNoPresenceOf(projectPath.append("bin").append("bin2")); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /* + * Regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=119161 + */ + public void test0012() throws JavaModelException { + IPath projectPath = env.addProject("P"); + env.removePackageFragmentRoot(projectPath, ""); + IPath src = env.addPackageFragmentRoot(projectPath, "", new IPath[] {new Path("p1/p2/p3/X.java"), new Path("Y.java")}, null, ""); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src, "p1.p2.p3", "X", + "package p1.p2.p3;\n" + + "public class X {}" + ); + fullBuild(); + expectingNoProblems(); + + env.addClass(src, "", "Y", + "import p1.p2.p3.X;\n" + + "public class Y extends X {}" + ); + incrementalBuild(); + expectingNoProblems(); + } + +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java new file mode 100644 index 0000000000..7da9c868fe --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/OutputFolderTests.java @@ -0,0 +1,323 @@ +/******************************************************************************* + * Copyright (c) 2000, 2021 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.builder; + +import junit.framework.*; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.core.JavaModelManager; +import org.eclipse.jdt.internal.core.JavaProject; + +/** + * Basic tests of the image builder. + */ +public class OutputFolderTests extends BuilderTests { + + public OutputFolderTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(OutputFolderTests.class); + } + + public void testChangeOutputFolder() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin1 = env.setOutputFolder(projectPath, "bin1"); //$NON-NLS-1$ + + env.addClass(root, "p", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n" + //$NON-NLS-1$ + "public class Test {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(bin1.append("p/Test.class")); //$NON-NLS-1$ + + IPath bin2 = env.setOutputFolder(projectPath, "bin2"); //$NON-NLS-1$ + incrementalBuild(); + expectingNoProblems(); + expectingPresenceOf(bin2.append("p/Test.class")); //$NON-NLS-1$ + } + + public void testDeleteOutputFolder() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath root = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Test {}" //$NON-NLS-1$ + ); + env.addFile(root, "Test.txt", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[]{ + bin.append("Test.class"), //$NON-NLS-1$ + bin.append("Test.txt") //$NON-NLS-1$ + }); + + env.removeFolder(bin); +// incrementalBuild(); currently not detected by the incremental builder... should it? + fullBuild(); + expectingPresenceOf(new IPath[]{ + bin.append("Test.class"), //$NON-NLS-1$ + bin.append("Test.txt") //$NON-NLS-1$ + }); + } + /* + * Ensures that changing the output to be the project (when the project has a source folder src) + * doesn't scrub the project on exit/restart. + * (regression test for bug 32588 Error saving changed source files; all files in project deleted) + */ + public void testInvalidOutput() throws JavaModelException { + // setup project with 1 src folder and 1 output folder + IPath projectPath = env.addProject("P"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + // add cu and build + env.addClass(projectPath, "src", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + fullBuild(); + expectingNoProblems(); + + // set invalid output foder by editing the .classpath file + env.addFile( + projectPath, + ".classpath", //$NON-NLS-1$ + "\n" + //$NON-NLS-1$ + "\n" + //$NON-NLS-1$ + " \n" + //$NON-NLS-1$ + " \n" + //$NON-NLS-1$ //$NON-NLS-2$ + " \n" + //$NON-NLS-1$ + "" //$NON-NLS-1$ + ); + + // simulate exit/restart + JavaModelManager manager = JavaModelManager.getJavaModelManager(); + JavaProject project = manager.getJavaModel().getJavaProject("P"); //$NON-NLS-1$ + manager.removePerProjectInfo(project, true /* remove external jar files indexes and timestamps*/); + + // change cu and build + IPath cuPath = env.addClass(projectPath, "src", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A { String s;}" //$NON-NLS-1$ + ); + incrementalBuild(); + + expectingPresenceOf(new IPath[] {cuPath}); + } + + public void testSimpleProject() throws JavaModelException { + IPath projectPath = env.addProject("P1"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, ""); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(projectPath, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + bin.append("A.class"), //$NON-NLS-1$ + bin.append("p/B.class") //$NON-NLS-1$ + }); + } + + public void testProjectWithBin() throws JavaModelException { + IPath projectPath = env.addProject("P2"); //$NON-NLS-1$ + IPath src = env.getPackageFragmentRootPath(projectPath, ""); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(src, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + bin.append("A.class"), //$NON-NLS-1$ + bin.append("p/B.class") //$NON-NLS-1$ + }); + } + + public void testProjectWithSrcBin() throws JavaModelException { + IPath projectPath = env.addProject("P3"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(src, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + bin.append("A.class"), //$NON-NLS-1$ + bin.append("p/B.class") //$NON-NLS-1$ + }); + } + + public void testProjectWith2SrcBin() throws JavaModelException { + IPath projectPath = env.addProject("P4"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1"); //$NON-NLS-1$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(src2, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + bin.append("A.class"), //$NON-NLS-1$ + bin.append("p/B.class") //$NON-NLS-1$ + }); + } + + public void testProjectWith2SrcAsBin() throws JavaModelException { + IPath projectPath = env.addProject("P5"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "src1"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2", null, "src2"); //$NON-NLS-1$ //$NON-NLS-2$ + /*IPath bin =*/ env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(src2, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + src1.append("A.class"), //$NON-NLS-1$ + src2.append("p/B.class") //$NON-NLS-1$ + }); + } + + public void testProjectWith2Src2Bin() throws JavaModelException { + IPath projectPath = env.addProject("P6"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "bin1"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin1"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(src2, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("bin1/A.class"), //$NON-NLS-1$ + projectPath.append("bin2/p/B.class") //$NON-NLS-1$ + }); + } + + public void testProjectWith3Src2Bin() throws JavaModelException { + IPath projectPath = env.addProject("P6"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src1 = env.addPackageFragmentRoot(projectPath, "src1", null, "bin1"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + IPath src3 = env.addPackageFragmentRoot(projectPath, "src3", null, "bin2"); //$NON-NLS-1$ //$NON-NLS-2$ + env.setOutputFolder(projectPath, "bin1"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(src1, "", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "public class A {}" //$NON-NLS-1$ + ); + env.addClass(src2, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + env.addClass(src3, "", "C", //$NON-NLS-1$ //$NON-NLS-2$ + "public class C {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(new IPath[] { + projectPath.append("bin1/A.class"), //$NON-NLS-1$ + projectPath.append("bin2/p/B.class"), //$NON-NLS-1$ + projectPath.append("bin2/C.class") //$NON-NLS-1$ + }); + } + + public void test2ProjectWith1Bin() throws JavaModelException { + IPath projectPath = env.addProject("P7"); //$NON-NLS-1$ + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath bin = env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath projectPath2 = env.addProject("P8"); //$NON-NLS-1$ + IPath binLocation = env.getProject(projectPath).getFolder("bin").getLocation(); //$NON-NLS-1$ + env.setExternalOutputFolder(projectPath2, "externalBin", binLocation); //$NON-NLS-1$ + env.addExternalJars(projectPath2, Util.getJavaClassLibs()); + env.addRequiredProject(projectPath2, projectPath); + + env.addClass(projectPath2, "p", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;"+ //$NON-NLS-1$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + expectingPresenceOf(bin.append("p/B.class")); //$NON-NLS-1$ + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java new file mode 100644 index 0000000000..1726887695 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageInfoTest.java @@ -0,0 +1,737 @@ +/******************************************************************************* + * Copyright (c) 2000, 2018 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * 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.builder; + +import java.io.File; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; + +import junit.framework.Test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; + +@SuppressWarnings("rawtypes") +public class PackageInfoTest extends BuilderTests { + +public PackageInfoTest(String name) { + super(name); +} +// Static initializer to specify tests subset using TESTS_* static variables +// All specified tests which does not belong to the class are skipped... +static { +// TESTS_NAMES = new String[] { "testBug374063" }; +// TESTS_NUMBERS = new int[] { 3 }; +// TESTS_RANGE = new int[] { 21, 50 }; +} +public static Test suite() { + return buildTestSuite(PackageInfoTest.class); +} +public void test001() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "pack", "Annot", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack;\n" + //$NON-NLS-1$ + "public @interface Annot {}" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + + IPath packageInfoPath = env.addFile(root, "pack/package-info.java", //$NON-NLS-1$ + "@Annot package p1" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlyProblemsFor(packageInfoPath); + final Problem[] problems = env.getProblems(); + Arrays.sort(problems); + assertNotNull(problems); + final StringWriter stringWriter = new StringWriter(); + final PrintWriter writer = new PrintWriter(stringWriter); + final int problemsLength = problems.length; + if (problemsLength == 1) { + writer.print(problems[0].getMessage()); + } else { + for (int i = 0; i < problemsLength - 1; i++) + writer.println(problems[i].getMessage()); + writer.print(problems[problemsLength - 1].getMessage()); + } + writer.close(); + final String expectedOutput = + "Syntax error on token \"p1\", ; expected after this token\n" + + "The declared package \"p1\" does not match the expected package \"pack\""; + assertSourceEquals("Different messages", expectedOutput, stringWriter.toString()); +} +public void test002() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "testcase", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package testcase;\n" + + "\n" + + "public class Main {\n" + + " public static void main(String[] argv) throws Exception {\n" + + " Package pkg = Package.getPackage(\"testcase\");\n" + + " System.out.print(pkg.getAnnotation(TestAnnotation.class));\n" + + " pkg = Class.forName(\"testcase.package-info\").getPackage();\n" + + " System.out.print(pkg.getAnnotation(TestAnnotation.class));\n" + + " }\n" + + "}" + ); + + env.addClass(root, "testcase", "TestAnnotation", //$NON-NLS-1$ //$NON-NLS-2$ + "package testcase;\n" + + "\n" + + "import static java.lang.annotation.ElementType.PACKAGE;\n" + + "import static java.lang.annotation.RetentionPolicy.RUNTIME;\n" + + "\n" + + "import java.lang.annotation.Retention;\n" + + "import java.lang.annotation.Target;\n" + + "\n" + + "@Target(PACKAGE)\n" + + "@Retention(RUNTIME)\n" + + "public @interface TestAnnotation {\n" + + "}" + ); + + env.addFile(root, "testcase/package-info.java", //$NON-NLS-1$ + "@TestAnnotation package testcase;" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + String javaVersion = System.getProperty("java.version"); + if (javaVersion != null && JavaCore.compareJavaVersions(javaVersion, "9") >= 0) { + expectingProblemsFor(new Path("/Project/src/testcase/Main.java"), + "Problem : The method getPackage(String) from the type Package is deprecated [ resource : range : <125,147> category : <110> severity : <1>]"); + } else { + expectingNoProblems(); + } + executeClass(projectPath, "testcase.Main", "@testcase.TestAnnotation()@testcase.TestAnnotation()", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ +} +public void test003() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addPackage(root, "testcase"); + IPath packageInfoPath = env.addFile(root, "testcase/package-info.java", //$NON-NLS-1$ + "" //$NON-NLS-1$ + ); + + incrementalBuild(projectPath); + expectingOnlySpecificProblemFor( + packageInfoPath, + new Problem("testcase/package-info.java", "The declared package \"\" does not match the expected package \"testcase\"", packageInfoPath, 0, 0, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ +} +// test for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=252555 : NPE +// on duplicate package-info +public void test004() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath otherRoot = env.addPackageFragmentRoot(projectPath, "test"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addPackage(root, "my.foo"); + env.addPackage(otherRoot, "my.foo"); + + env.addFile(root, "my/foo/package-info.java", //$NON-NLS-1$ + "/**\n" + + "* A demo package for foo.\n" + + "*/\n" + + "package my.foo;\n" + ); + + IPath otherPackageInfoPath = env.addFile(otherRoot, + "my/foo/package-info.java", //$NON-NLS-1$ + "/**\n" + + "* A demo package for foo.\n" + + "*/\n" + + "package my.foo;\n" + ); + + incrementalBuild(projectPath); + expectingOnlySpecificProblemFor( + otherPackageInfoPath, + new Problem("my/foo/package-info.java", "The type package-info is already defined", otherPackageInfoPath, 0, 0, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ +} +// test for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=258145 : JME +// on duplicate package-info +public void test258145() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath otherRoot = env.addPackageFragmentRoot(projectPath, "test"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addPackage(root, "my.foo"); + env.addFile(root, "my/foo/package-info.java", //$NON-NLS-1$ + "/**\n" + + "* A demo package for foo.\n" + + "*/\n" + + "package my.foo;\n" + ); + + fullBuild(projectPath); + + env.addPackage(otherRoot, "my.foo"); + + IPath otherPackageInfoPath = env.addFile(otherRoot, + "my/foo/package-info.java", //$NON-NLS-1$ + "/**\n" + + "* A demo package for foo.\n" + + "*/\n" + + "package my.foo;\n" + ); + + incrementalBuild(projectPath); + expectingOnlySpecificProblemFor( + otherPackageInfoPath, + new Problem("my/foo/package-info.java", "The type package-info is already defined", otherPackageInfoPath, 0, 0, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785 +// (NPE upon creation/deletion of package-info.java in default package) +public void test323785 () throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + fullBuild(projectPath); + + env.addFile(root, "package-info.java", ""); + + incrementalBuild(projectPath); + expectingNoProblems(); + +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=323785 +// verify that changes to package info containing secondary types do trigger incremental build. +public void test323785a () throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + IPath xJavaPath = env.addFile(root, "X.java", "class X extends Y {}\n"); + fullBuild(projectPath); + env.addFile(root, "package-info.java", "class Y {}\n"); + incrementalBuild(projectPath); + expectingNoProblems(); + env.addFile(root, "package-info.java", "final class Y {}\n"); + incrementalBuild(projectPath); + expectingOnlySpecificProblemFor( + xJavaPath, + new Problem("X.java", "The type X cannot subclass the final class Y", xJavaPath, 16, 17, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); + +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=372012 +// test missing default nullness annotation for a package without package-info +// test when the package-info is added with the default annotation, the problem disappears +public void testBug372012() throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath srcRoot = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_REDUNDANT_NULL_ANNOTATION, JavaCore.ERROR); + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(\"\");\n" + + " }\n" + + " class Test1Inner{}\n" + + "}"; + String test2Code = "package p1;\n" + + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "public class Test2 {\n" + + " public void bar(String str) {}\n" + + "}"; + String test3Code = "package p1;\n" + + "public class Test3 {\n" + + " public void bar(String str) {}\n" + + "}"; + + IPath test1Path = env.addClass(srcRoot, "p1", "Test1", test1Code); + env.addClass(srcRoot, "p1", "Test2", test2Code); + env.addClass(srcRoot, "p1", "Test3", test3Code); + + fullBuild(projectPath); + expectingNoProblemsFor(test1Path); + // should have only one marker + expectingProblemsFor(srcRoot, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // add package-info.java with default annotation + String packageInfoCode = "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package p1;\n"; + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + incrementalBuild(projectPath); + expectingProblemsFor(projectPath, + "Problem : Nullness default is redundant with a default specified for the enclosing package p1 [ resource : range : <12,56> category : <120> severity : <2>]"); + + // verify that all package CU's were recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test1$Test1Inner", "p1.Test2", "p1.Test3", "p1.package-info" }); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=372012 +// test missing default nullness annotation for a package without package-info +// test when the the default annotations are added to all top level types, the problem stays +public void testBug372012a() throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath srcRoot = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_REDUNDANT_NULL_ANNOTATION, JavaCore.ERROR); + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(\"\");\n" + + " }\n" + + " class Test1Inner{}\n" + + "}"; + String test2Code = "package p1;\n" + + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "public class Test2 {\n" + + " public void bar(String str) {}\n" + + "}"; + + IPath test1Path = env.addClass(srcRoot, "p1", "Test1", test1Code); + env.addClass(srcRoot, "p1", "Test2", test2Code); + + fullBuild(projectPath); + expectingNoProblemsFor(test1Path); + // should have only one marker + expectingProblemsFor(srcRoot, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // add default annotation to Test1 + test1Code = "package p1;\n" + + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(\"\");\n" + + " }\n" + + " class Test1Inner{}\n" + + "}"; + env.addClass(srcRoot, "p1", "Test1", test1Code); + incrementalBuild(projectPath); + // should have only one marker + expectingProblemsFor(srcRoot, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // verify that all package CU's were recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test1$Test1Inner"}); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=372012 +// test missing default nullness annotation for a package without package-info +// test when the the default annotations is added to only 1 top level type, the problem stays +public void testBug372012b() throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath srcRoot = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_REDUNDANT_NULL_ANNOTATION, JavaCore.ERROR); + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(\"\");\n" + + " }\n" + + " class Test1Inner{}\n" + + "}"; + String test2Code = "package p1;\n" + + "public class Test2 {\n" + + " public void bar(String str) {}\n" + + "}"; + + IPath test1Path = env.addClass(srcRoot, "p1", "Test1", test1Code); + env.addClass(srcRoot, "p1", "Test2", test2Code); + + fullBuild(projectPath); + expectingNoProblemsFor(test1Path); + // should have only one marker + expectingProblemsFor(srcRoot, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // add default annotation to Test1 + test1Code = "package p1;\n" + + "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(\"\");\n" + + " }\n" + + " class Test1Inner{}\n" + + "}"; + env.addClass(srcRoot, "p1", "Test1", test1Code); + incrementalBuild(projectPath); + // should have only one marker + expectingProblemsFor(srcRoot, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // verify that only Test1's CU's were recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test1$Test1Inner"}); +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=372012 +// test missing default nullness annotation for a package with package-info +// test when the the default annotation is removed from package-info, the problem comes back +public void testBug372012c() throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath srcRoot = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_REDUNDANT_NULL_ANNOTATION, JavaCore.ERROR); + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public void foo() {\n" + + " new Test2().bar(\"\");\n" + + " }\n" + + " class Test1Inner{}\n" + + "}"; + String test2Code = "package p1;\n" + + "public class Test2 {\n" + + " public void bar(String str) {}\n" + + "}"; + // add package-info.java with default annotation + String packageInfoCode = "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package p1;\n"; + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + + env.addClass(srcRoot, "p1", "Test1", test1Code); + env.addClass(srcRoot, "p1", "Test2", test2Code); + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + + fullBuild(projectPath); + // default annotation present, so no problem + expectingNoProblemsFor(srcRoot); + + // add package-info.java with default annotation + packageInfoCode = + "package p1;\n"; + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + incrementalBuild(projectPath); + expectingProblemsFor(projectPath, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // verify that all package CU's were recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test1$Test1Inner", "p1.Test2", "p1.package-info" }); +} + +/** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=367836 + */ +public void testBug367836() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(src, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class A {}" //$NON-NLS-1$ + ); + + IPath bPath = env.addClass(src, "p", "package-info", //$NON-NLS-1$ //$NON-NLS-2$ + "" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlySpecificProblemFor(bPath, + new Problem("", "The declared package \"\" does not match the expected package \"p\"", bPath, 0, 0, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=374063 +// verify that markers are created on the correct resource +public void testBug374063() throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath srcRoot = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_REDUNDANT_NULL_ANNOTATION, JavaCore.ERROR); + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public String output(List integers) {\n" + + " return \"\";\n" + + " }\n" + + " public void output(List doubles) {}\n" + + "}"; + + env.addClass(srcRoot, "p1", "Test1", test1Code); + + fullBuild(projectPath); + // resource for compile errors should be Test1 and not p1 + expectingProblemsFor(projectPath, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <130,134> category : <40> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <58,62> category : <40> severity : <2>]"); + + // add package-info.java with default annotation + String packageInfoCode = "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package p1;\n"; + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + incrementalBuild(projectPath); + expectingProblemsFor(projectPath, + "Problem : List cannot be resolved to a type [ resource : range : <130,134> category : <40> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <58,62> category : <40> severity : <2>]"); + + // verify that all package CU's were recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.package-info" }); +} +// 382960 +public void testBug382960() throws JavaModelException, CoreException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + env.removePackageFragmentRoot(projectPath, ""); + IPath srcRoot = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + " public String output(List integers) {\n" + + " return \"\";\n" + + " }\n" + + " public void output(List doubles) {}\n" + + "}"; + + env.addClass(srcRoot, "p1", "Test1", test1Code); + String packageInfoCode = "package p1;\n"; + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + fullBuild(projectPath); + expectingProblemsFor(projectPath, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <130,134> category : <40> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <58,62> category : <40> severity : <2>]"); + + packageInfoCode = "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package p1;\n"; + env.addClass(srcRoot, "p1", "package-info", packageInfoCode); + incrementalBuild(projectPath); + expectingProblemsFor(projectPath, + "Problem : List cannot be resolved to a type [ resource : range : <130,134> category : <40> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <58,62> category : <40> severity : <2>]"); + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.package-info" }); + + IProject project = env.getProject(projectPath); + IFile packageInfo = project.getFile("/src/p1/package-info.java"); + packageInfo.touch(null); + + incrementalBuild(projectPath); + expectingProblemsFor(projectPath, + "Problem : List cannot be resolved to a type [ resource : range : <130,134> category : <40> severity : <2>]\n" + + "Problem : List cannot be resolved to a type [ resource : range : <58,62> category : <40> severity : <2>]"); + + // verify that only package-info was recompiled + expectingUniqueCompiledClasses(new String[] { "p1.package-info" }); +} +// test that when a package-info.java has been created, markers on the +// package fragments in all source folders are removed. +public void testBug525469() throws JavaModelException { + + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + fullBuild(projectPath); + + // remove old package fragment root so that names don't collide + env.removePackageFragmentRoot(projectPath, ""); + + IPath srcRoot1 = env.addPackageFragmentRoot(projectPath, "src1"); + IPath srcRoot2 = env.addPackageFragmentRoot(projectPath, "src2"); + env.setOutputFolder(projectPath, "bin"); + // prepare the project: + setupProjectForNullAnnotations(projectPath); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_MISSING_NONNULL_BY_DEFAULT_ANNOTATION, JavaCore.ERROR); + env.getJavaProject(projectPath).setOption(JavaCore.COMPILER_PB_REDUNDANT_NULL_ANNOTATION, JavaCore.ERROR); + + String test1Code = "package p1;\n" + + "public class Test1 {\n" + + "}"; + env.addClass(srcRoot1, "p1", "Test1", test1Code); + + String otherClassCode = "package p2;\n" + + "public class OtherClass {\n" + + "}"; + env.addClass(srcRoot1, "p2", "OtherClass", otherClassCode); + + String packageInfoCode2 = "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package p2;\n"; + env.addClass(srcRoot1, "p2", "package-info", packageInfoCode2); + + fullBuild(projectPath); + + String test2Code = "package p1;\n" + + "public class Test2 {\n" + + "}"; + + env.addClass(srcRoot2, "p1", "Test2", test2Code); + incrementalBuild(projectPath); + + // after the incremental build, as there is no package-info.java for p1, the error is visible in both source directories on the directory for the package p1 + expectingProblemsFor(projectPath, + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]\n" + + "Problem : A default nullness annotation has not been specified for the package p1 [ resource : range : <8,10> category : <90> severity : <2>]"); + + // add package-info.java with default annotation + String packageInfoCode1 = "@org.eclipse.jdt.annotation.NonNullByDefault\n" + + "package p1;\n"; + env.addClass(srcRoot1, "p1", "package-info", packageInfoCode1); + + // an incremental build is requested, but it will switch to a full build + incrementalBuild(projectPath); + + // verify the expected behaviour: the error marker in the src2 directory must be gone, too + expectingProblemsFor(projectPath, + ""); + + // verify the implementation by doing a full build: all files have been recompiled + expectingUniqueCompiledClasses(new String[] { "p1.Test1", "p1.Test2", "p1.package-info", "p2.OtherClass", "p2.package-info" }); +} + +void setupProjectForNullAnnotations(IPath projectPath) throws JavaModelException { + // add the org.eclipse.jdt.annotation library (bin/ folder or jar) to the project: + File bundleFile = FileLocator.getBundleFileLocation(Platform.getBundle("org.eclipse.jdt.annotation")).get(); + String annotationsLib = bundleFile.isDirectory() ? bundleFile.getPath()+"/bin" : bundleFile.getPath(); + IJavaProject javaProject = env.getJavaProject(projectPath); + IClasspathEntry[] rawClasspath = javaProject.getRawClasspath(); + int len = rawClasspath.length; + System.arraycopy(rawClasspath, 0, rawClasspath = new IClasspathEntry[len+1], 0, len); + rawClasspath[len] = JavaCore.newLibraryEntry(new Path(annotationsLib), null, null); + javaProject.setRawClasspath(rawClasspath, null); + + javaProject.setOption(JavaCore.COMPILER_ANNOTATION_NULL_ANALYSIS, JavaCore.ENABLED); +} + +protected void assertSourceEquals(String message, String expected, String actual) { + if (actual == null) { + assertEquals(message, expected, null); + return; + } + actual = org.eclipse.jdt.core.tests.util.Util.convertToIndependantLineDelimiter(actual); + if (!actual.equals(expected)) { + System.out.print(org.eclipse.jdt.core.tests.util.Util.displayString(actual.toString(), 0)); + } + assertEquals(message, expected, actual); +} +public static Class testClass() { + return PackageInfoTest.class; +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java new file mode 100644 index 0000000000..693a4b3f83 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/PackageTests.java @@ -0,0 +1,293 @@ +/******************************************************************************* + * Copyright (c) 2000, 2020 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.builder; + +import java.io.File; + +import junit.framework.*; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.Util; + +public class PackageTests extends BuilderTests { + + public PackageTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(PackageTests.class); + } + + /** + * Bugs 6564 + */ + public void testNoPackageProblem() throws JavaModelException { + //---------------------------- + // Step 1 + //---------------------------- + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(src, "pack", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package pack;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(src2, "p1", "X", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n"+ //$NON-NLS-1$ + "public class X {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(src2, "p2", "Y", //$NON-NLS-1$ //$NON-NLS-2$ + "package p2;\n"+ //$NON-NLS-1$ + "public class Y extends p1.X {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + env.addClass(src2, "p3", "Z", //$NON-NLS-1$ //$NON-NLS-2$ + "package p3;\n"+ //$NON-NLS-1$ + "public class Z extends p2.Y {\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + + fullBuild(); + expectingNoProblems(); + + //---------------------------- + // Step 2 + //---------------------------- + env.removeClass(env.getPackagePath(src, "pack"), "X"); //$NON-NLS-1$ //$NON-NLS-2$ + env.removePackage(src2, "p3"); //$NON-NLS-1$ + + incrementalBuild(); + expectingNoProblems(); + } + + /** + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=251690 + */ + public void testPackageProblem() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath aPath = env.addClass(src, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class A {}" //$NON-NLS-1$ + ); + + IPath bPath = env.addClass(src, "p.A", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "public class B {}" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlySpecificProblemFor(aPath, + new Problem("", "The type A collides with a package", aPath, 24, 25, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + expectingOnlySpecificProblemFor(bPath, + new Problem("", "The declared package \"\" does not match the expected package \"p.A\"", bPath, 0, 1, CategorizedProblem.CAT_INTERNAL, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + + public void testNoFolderProblem() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(src, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class A {}" //$NON-NLS-1$ + ); + + // create folder & contained non-java file (which don't establish package p.A!): + env.addFolder(src, "p/A"); //$NON-NLS-1$ + env.addFile(src, "p/A/some.properties", //$NON-NLS-1$ + "name=Some\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + } + + public void testNoFolderProblem2() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + IPath src2 = env.addPackageFragmentRoot(projectPath, "src2"); + + // create folder & contained non-java file (which don't establish package p.A!): + env.addFolder(src, "p/A"); //$NON-NLS-1$ + env.addFile(src, "p/A/some.properties", //$NON-NLS-1$ + "name=Some\n" //$NON-NLS-1$ + ); + + env.addClass(src2, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class A {}" //$NON-NLS-1$ + ); + + IPath project2Path = env.addProject("Project2"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(project2Path, ""); //$NON-NLS-1$ + IPath srcP2 = env.addPackageFragmentRoot(project2Path, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + env.addRequiredProject(project2Path, projectPath, false); + + env.addClass(srcP2, "q", "Main", + "package q;\n" + + "import p.A;\n" + + "public class Main {\n" + + " A field;\n" + + "}\n"); + + fullBuild(); + expectingNoProblems(); + } + + public void testNestedPackageProblem() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath src = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath aPath = env.addClass(src, "p", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p;\n"+ //$NON-NLS-1$ + "public class A {}\n" //$NON-NLS-1$ + ); + + // a class in a sub-package of p.A seems to establish package p.A, too, causing a conflict indeed: + env.addClass(src, "p.A.c", "B", //$NON-NLS-1$ //$NON-NLS-2$ + "package p.A.c;\n" + + "public class B {}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingOnlySpecificProblemFor(aPath, + new Problem("", "The type A collides with a package", aPath, 24, 25, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); //$NON-NLS-1$ //$NON-NLS-2$ + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=117092 +// simplistic linked subfolder used as package, external case (not in workspace) +public void test001() throws CoreException { + IPath projectPath = env.addProject("P"); + try { + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath src = env.addPackageFragmentRoot(projectPath, "src"); + IPath bin = env.setOutputFolder(projectPath, "bin"); + env.addClass(src, "p", "X", + "package p;\n" + + "public class X {\n" + + "}\n" + ); + File tmpDir = env.getTmpDirectory(); + File externalPackageDir = new File(tmpDir.getAbsolutePath() + File.separator + "q"); + externalPackageDir.mkdir(); + IFolder folder = env.getWorkspace().getRoot().getFolder(src.append("p/q")); + folder.createLink(externalPackageDir.toURI(), 0, null); + env.addClass(src, "p.q", "Y", + "package p.q;\n" + + "public class Y extends p.X {\n" + + "}\n" + ); + env.addClass(src, "p.q.r", "Z", + "package p.q.r;\n" + + "public class Z extends p.q.Y {\n" + + "}\n" + ); + assertTrue(new File(externalPackageDir.getAbsolutePath() + + File.separator + "r" + File.separator + "Z.java").exists()); + fullBuild(); + expectingPresenceOf(bin.append("p/q/r/Z.class")); + + expectingNoProblems(); + env.removeClass(env.getPackagePath(src, "p.q.r"), "Z"); + env.removePackage(src, "p.q.r"); + incrementalBuild(); + expectingNoProblems(); + } finally { + env.deleteTmpDirectory(); + env.removeProject(projectPath); + } +} + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=117092 +// simplistic linked subfolder used as package, internal case (in workspace) +public void test002() throws CoreException { + IPath projectPath = env.addProject("P"); + IPath externalProjectPath = env.addProject("EP"); + try { + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath src = env.addPackageFragmentRoot(projectPath, "src"); + IPath bin = env.setOutputFolder(projectPath, "bin"); + env.addClass(src, "p", "X", + "package p;\n" + + "public class X {\n" + + "}\n" + ); + IProject externalProject = env.getProject(externalProjectPath); + IFolder externalFolder = externalProject.getFolder("q"); + externalFolder.create(false /* no need to force */, true /*local */, + null /* no progress monitor */); + IFolder folder = env.getWorkspace().getRoot().getFolder(src.append("p/q")); + folder.createLink(externalFolder.getLocationURI(), 0, null); + env.addClass(src, "p.q", "Y", + "package p.q;\n" + + "public class Y extends p.X {\n" + + "}\n" + ); + env.addClass(src, "p.q.r", "Z", + "package p.q.r;\n" + + "public class Z extends p.q.Y {\n" + + "}\n" + ); + assertTrue(new File(externalFolder.getLocation() + + File.separator + "r" + File.separator + "Z.java").exists()); + env.incrementalBuild(projectPath); + expectingPresenceOf(bin.append("p/q/r/Z.class")); + + expectingNoProblems(); + env.removeClass(env.getPackagePath(src, "p.q.r"), "Z"); + env.removePackage(src, "p.q.r"); + env.incrementalBuild(projectPath); + expectingNoProblems(); + } finally { + env.deleteTmpDirectory(); + env.removeProject(projectPath); + env.removeProject(externalProjectPath); + } +} +} + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java new file mode 100644 index 0000000000..93a90abd4a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ParticipantBuildTests.java @@ -0,0 +1,537 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import java.io.*; +import java.util.*; + +import junit.framework.*; + +import org.eclipse.core.runtime.*; +import org.eclipse.core.resources.*; +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.compiler.*; +import org.eclipse.jdt.core.dom.*; +import org.eclipse.jdt.core.tests.util.Util; + +@SuppressWarnings({"rawtypes", "unchecked"}) +public class ParticipantBuildTests extends BuilderTests { + /** + * Internal synonym for deprecated constant AST.JSL3 + * to alleviate deprecation warnings. + * @deprecated + */ + /*package*/ static final int JLS3_INTERNAL = AST.JLS3; + + public ParticipantBuildTests(String name) { + super(name); + } + + public void tearDown() throws Exception { + TestBuilderParticipant.PARTICIPANT = null; + super.tearDown(); + } + + public static Test suite() { + return buildTestSuite(ParticipantBuildTests.class); + } + + static class BuildTestParticipant extends CompilationParticipant { + BuildTestParticipant() { + TestBuilderParticipant.PARTICIPANT = this; + } + } + + static class ParticipantProblem extends CategorizedProblem { + int counter = 0; + String message; + int id; + char[] filename; + ParticipantProblem(String message, String filename) { + this.message = message; + this.id = this.counter ++; + this.filename = filename.toCharArray(); + } + public String[] getArguments() { return new String[0]; } + public int getID() { return this.id; } + public String getMessage() { return this.message; } + public char[] getOriginatingFileName() { return this.filename; } + public int getSourceStart() { return 0; } + public int getSourceEnd() { return 0; } + public int getSourceLineNumber() { return 1; } + public boolean isError() { return true; } + public boolean isWarning() { return false; } + public boolean isInfo() { return false; } + public void setSourceEnd(int sourceEnd) {/* not needed */} + public void setSourceLineNumber(int lineNumber) {/* not needed */} + public void setSourceStart(int sourceStart) {/* not needed */} + public int getCategoryID() { return 0; } + public String getMarkerType() { return "org.eclipse.jdt.core.tests.compile.problem"; } + } + + CompilationUnit buildCompilationUnit(BuildContext file) { + IJavaProject javaProject = JavaCore.create(file.getFile().getProject()); + ASTParser p = ASTParser.newParser(JLS3_INTERNAL); + p.setProject(javaProject); + p.setSource(file.getContents()); + p.setResolveBindings(true); + p.setKind(ASTParser.K_COMPILATION_UNIT); + p.setUnitName(file.getFile().getName()); + return (CompilationUnit) p.createAST(null); + } + + public void testBuildStarting() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + IPath test = env.addClass(root, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Test extends GeneratedType {}\n" //$NON-NLS-1$ + ); + + // install compilationParticipant + new BuildTestParticipant() { + int buildPass = 0; + public void buildStarting(BuildContext[] files, boolean isBatchBuild) { + // want to add a gen'ed source file that is referenced from the initial file to see if its recompiled + BuildContext result = files[0]; + IFile genedType = result.getFile().getParent().getFile(new Path("GeneratedType.java")); //$NON-NLS-1$ + if (this.buildPass == 0 || this.buildPass == 3) { + try { + genedType.create(new ByteArrayInputStream("public class GeneratedType {}".getBytes()), true, null); //$NON-NLS-1$ + } catch (CoreException e) { + e.printStackTrace(); + } + result.recordAddedGeneratedFiles(new IFile[] {genedType}); + } else if (this.buildPass == 1) { + try { + genedType.delete(true, null); + } catch (CoreException e) { + e.printStackTrace(); + } + result.recordDeletedGeneratedFiles(new IFile[] {genedType}); + } + this.buildPass++; + } + }; + incrementalBuild(projectPath); + expectingNoProblems(); + + // GeneratedType will be deleted + env.addClass(root, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Test extends GeneratedType {}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingOnlySpecificProblemFor(test, new Problem("", "GeneratedType cannot be resolved to a type", test, 26, 39, CategorizedProblem.CAT_TYPE, IMarker.SEVERITY_ERROR)); + + // GeneratedType will be recreated + env.addClass(root, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Test extends GeneratedType {}\n" //$NON-NLS-1$ + ); + incrementalBuild(projectPath); + expectingNoProblems(); + } + + public void testDefaultValue() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "test", "EntryPoint", //$NON-NLS-1$ //$NON-NLS-2$ + "package test;\n" + //$NON-NLS-1$ + "public class EntryPoint { ClassWithNestedAnnotation nestedAnnotation; }" //$NON-NLS-1$ + ); + + env.addClass(root, "test", "ClassWithNestedAnnotation", //$NON-NLS-1$ //$NON-NLS-2$ + "package test;\n" + //$NON-NLS-1$ + "public class ClassWithNestedAnnotation {\n" + //$NON-NLS-1$ + " public final int FOUR = 4; \n " + //$NON-NLS-1$ + " public @interface NestedAnnotation {\n" + //$NON-NLS-1$ + " public enum Character { Winnie, Tiger, Piglet, Eore; }\n" + //$NON-NLS-1$ + " Character value() default Character.Eore; \n" + //$NON-NLS-1$ + " }\n" + //$NON-NLS-1$ + "}" //$NON-NLS-1$ + ); + + // install compilationParticipant + new BuildTestParticipant() { + public boolean isAnnotationProcessor() { + return true; + } + public void processAnnotations(BuildContext[] files) { + for (int i = 0, total = files.length; i < total; i++) { + IFile file = files[i].getFile(); + // Traversing the members of test.ClassWithNestedAnnotation through a reference in EntryPoint.java + if (!"EntryPoint.java".equals(file.getName())) continue; //$NON-NLS-1$ + + List problems = new ArrayList(); + CompilationUnit unit = buildCompilationUnit(files[i]); + List types = unit.types(); + for (int t = 0, l = types.size(); t < l; t++) { + AbstractTypeDeclaration typeDecl = (AbstractTypeDeclaration) types.get(t); + ITypeBinding typeBinding = typeDecl.resolveBinding(); + if (typeBinding == null) continue; + IVariableBinding[] fieldBindings = typeBinding.getDeclaredFields(); + for (int f = 0, fLength = fieldBindings.length; f < fLength; f++) { + IVariableBinding field = fieldBindings[f]; + if ("nestedAnnotation".equals(field.getName())) { + ITypeBinding fieldType = field.getType(); + ITypeBinding[] declaredTypes = fieldType.getDeclaredTypes(); + for (int d = 0, dLength = declaredTypes.length; d < dLength; d++) { + if (!"NestedAnnotation".equals(declaredTypes[d].getName())) continue; + IMethodBinding[] annotationMethods = declaredTypes[d].getDeclaredMethods(); + for (int m = 0, mLength = annotationMethods.length; m < mLength; m++) { + if (!"value".equals(annotationMethods[m].getName())) continue; + Object defaultValue = annotationMethods[m].getDefaultValue(); + assertTrue("Wrong class", defaultValue instanceof IVariableBinding); + IVariableBinding variableBinding = (IVariableBinding) defaultValue; + String defaultString = variableBinding.getName(); + String expected = "Eore"; + if (!expected.equals(defaultString)) { + IProblem problem = new ParticipantProblem("expecting default = " + expected + " not " + defaultString, file.getName()); + problems.add(problem); + } + } + } + IVariableBinding[] nestedFields = fieldType.getDeclaredFields(); + for (int nf = 0, nfLength = nestedFields.length; nf < nfLength; nf++) { + if (!nestedFields[nf].getName().equals("FOUR")) continue; + Object constant = nestedFields[nf].getConstantValue(); + String constantStr = constant == null ? "" : constant.toString(); + String expected = "4"; + if (!constantStr.equals(expected)) + problems.add(new ParticipantProblem("expecting constant = " + expected + " not " + constantStr, file.getName())); + } + } else { + problems.add(new ParticipantProblem("found unexpected field " + field, file.getName())); + } + } + } + if (!problems.isEmpty()) { + CategorizedProblem[] problemArray = new CategorizedProblem[problems.size()]; + problemArray = (CategorizedProblem[]) problems.toArray(problemArray); + files[i].recordNewProblems(problemArray); + } + } + } + }; + + fullBuild(projectPath); + expectingNoProblems(); + } + + /* + * Ensure that participants problems are correctly managed by the Java builder + * (regression test for bug 134345 Problems from CompilationParticipants do not get cleaned up unless there are Java errors) + */ + public void testParticipantProblems() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + + env.addClass(root, "p", "X", + "package p;\n" + + "public class X { /* generate problem*/ }" + ); + + // install compilationParticipant + new BuildTestParticipant() { + public void buildStarting(BuildContext[] files, boolean isBatch) { + for (int i = 0, total = files.length; i < total; i++) { + BuildContext context = files[i]; + if (CharOperation.indexOf("generate problem".toCharArray(), context.getContents(), true) != -1) { + context.recordNewProblems(new CategorizedProblem[] {new ParticipantProblem("Participant problem", context.getFile().getFullPath().toString())}); + } + } + } + }; + + fullBuild(projectPath); + expectingParticipantProblems(projectPath, "Participant problem"); + + env.addClass(root, "p", "X", + "package p;\n" + + "public class X { }" + ); + incrementalBuild(projectPath); + expectingParticipantProblems(projectPath, ""); + } + + public void testProcessAnnotationDeclarations() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "@interface TestAnnotation {}\n" + //$NON-NLS-1$ + "public class Test extends GeneratedType {}\n" //$NON-NLS-1$ + ); + + env.addClass(root, "", "Other", //$NON-NLS-1$ //$NON-NLS-2$ + "public class Other { MissingAnnotation m; }\n" //$NON-NLS-1$ + ); + + // install compilationParticipant + new BuildTestParticipant() { + int count = 2; + public boolean isAnnotationProcessor() { + return true; + } + public void processAnnotations(BuildContext[] files) { + // want to add a gen'ed source file that is referenced from the initial file to see if its recompiled + if (this.count == 2) { + this.count--; + BuildContext result = files[0]; + IFile genedType = result.getFile().getParent().getFile(new Path("MissingAnnotation.java")); //$NON-NLS-1$ + try { + genedType.create(new ByteArrayInputStream("public @interface MissingAnnotation {}".getBytes()), true, null); //$NON-NLS-1$ + } catch (CoreException e) { + e.printStackTrace(); + } + result.recordAddedGeneratedFiles(new IFile[] {genedType}); + } else if (this.count == 1) { + this.count--; + BuildContext result = files[0]; + IFile genedType = result.getFile().getParent().getFile(new Path("GeneratedType.java")); //$NON-NLS-1$ + try { + genedType.create(new ByteArrayInputStream("public class GeneratedType {}".getBytes()), true, null); //$NON-NLS-1$ + } catch (CoreException e) { + e.printStackTrace(); + } + result.recordAddedGeneratedFiles(new IFile[] {genedType}); + } + } + }; + + fullBuild(projectPath); + expectingNoProblems(); + } + + public void testProcessAnnotationQualifiedReferences() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "p1", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "@GeneratedAnnotation\n" + //$NON-NLS-1$ + "public class Test { public void method() { p1.p2.GeneratedType.method(); } }\n" //$NON-NLS-1$ + ); + + env.addClass(root, "p1", "GeneratedAnnotation", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "@interface GeneratedAnnotation{}\n" //$NON-NLS-1$ + ); + + // install compilationParticipant + new BuildTestParticipant() { + public boolean isAnnotationProcessor() { + return true; + } + public void processAnnotations(BuildContext[] files) { + // want to add a gen'ed source file that is referenced from the initial file to see if its recompiled + BuildContext result = files[0]; + IFile genedType = result.getFile().getProject().getFile(new Path("src/p1/p2/GeneratedType.java")); //$NON-NLS-1$ + if (genedType.exists()) return; + try { + IFolder folder = (IFolder) genedType.getParent(); + if(!folder.exists()) + folder.create(true, true, null); + genedType.create(new ByteArrayInputStream("package p1.p2; public class GeneratedType { public static void method(){} }".getBytes()), true, null); //$NON-NLS-1$ + } catch (CoreException e) { + e.printStackTrace(); + } + result.recordAddedGeneratedFiles(new IFile[] {genedType}); + } + }; + + fullBuild(projectPath); + expectingNoProblems(); + } + + public void testProcessAnnotationReferences() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "Test", //$NON-NLS-1$ //$NON-NLS-2$ + "@GeneratedAnnotation\n" + //$NON-NLS-1$ + "public class Test {}\n" //$NON-NLS-1$ + ); + + // install compilationParticipant + new BuildTestParticipant() { + public boolean isAnnotationProcessor() { + return true; + } + public void processAnnotations(BuildContext[] files) { + // want to add a gen'ed source file that is referenced from the initial file to see if its recompiled + BuildContext result = files[0]; + IFile genedType = result.getFile().getParent().getFile(new Path("GeneratedAnnotation.java")); //$NON-NLS-1$ + if (genedType.exists()) return; + try { + genedType.create(new ByteArrayInputStream("@interface GeneratedAnnotation {}".getBytes()), true, null); //$NON-NLS-1$ + } catch (CoreException e) { + e.printStackTrace(); + } + result.recordAddedGeneratedFiles(new IFile[] {genedType}); + } + }; + + fullBuild(projectPath); + expectingNoProblems(); + } + + public void testResolvedMethod() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); //$NON-NLS-1$ //$NON-NLS-2$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); //$NON-NLS-1$ + IPath root = env.addPackageFragmentRoot(projectPath, "src"); //$NON-NLS-1$ + env.setOutputFolder(projectPath, "bin"); //$NON-NLS-1$ + + env.addClass(root, "", "Try", //$NON-NLS-1$ //$NON-NLS-2$ + "@SuppressWarnings(\"all\")\n" + //$NON-NLS-1$ + "public class Try {}" //$NON-NLS-1$ + ); + + // install compilationParticipant + new BuildTestParticipant() { + public boolean isAnnotationProcessor() { + return true; + } + public void processAnnotations(BuildContext[] files) { + for (int i = 0, total = files.length; i < total; i++) { + IFile file = files[i].getFile(); + // Traversing the members of test.ClassWithNestedAnnotation through a reference in EntryPoint.java + if (!"Try.java".equals(file.getName())) continue; //$NON-NLS-1$ + + List problems = new ArrayList(); + CompilationUnit unit = buildCompilationUnit(files[i]); + List types = unit.types(); + for (int t = 0, l = types.size(); t < l; t++) { + AbstractTypeDeclaration typeDecl = (AbstractTypeDeclaration) types.get(t); + ITypeBinding typeBinding = typeDecl.resolveBinding(); + if (typeBinding == null) continue; + IAnnotationBinding[] annotations = typeBinding.getAnnotations(); + if (annotations == null || annotations.length == 0) { + throw new IllegalStateException( + "Expected at least one annotation in binding " + typeBinding); + } + IAnnotationBinding targetValue = annotations[0]; + typeBinding = targetValue.getAnnotationType(); + + IMemberValuePairBinding[] pairs = targetValue.getAllMemberValuePairs(); + if (pairs == null || pairs.length == 0) { + throw new IllegalStateException( + "Expected at least one member value pair in " + targetValue + + ", binding was: " + typeBinding); + } + IMethodBinding method = pairs[0].getMethodBinding(); + if (!"value".equals(method.getName())) + problems.add(new ParticipantProblem("method " + method.getName() + " not found", file.getName())); + } + if (!problems.isEmpty()) { + CategorizedProblem[] problemArray = new CategorizedProblem[problems.size()]; + problemArray = (CategorizedProblem[]) problems.toArray(problemArray); + files[i].recordNewProblems(problemArray); + } + } + } + }; + + fullBuild(projectPath); + expectingNoProblems(); + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test1001() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + env.addClass(root, "p", "X", + "package p;\n" + + "public class X { /* generate problem*/ }" + ); + new BuildTestParticipant() { + public void buildStarting(BuildContext[] files, boolean isBatch) { + for (int i = 0, total = files.length; i < total; i++) { + BuildContext context = files[i]; + if (CharOperation.indexOf("generate problem".toCharArray(), + context.getContents(), true) != -1) { + context.recordNewProblems(new CategorizedProblem[] { + new ParticipantProblem("Participant problem", context.getFile().getFullPath().toString())}); + } + } + } + }; + fullBuild(projectPath); + Problem[] problems = env.getProblemsFor(projectPath, "org.eclipse.jdt.core.tests.compile.problem"); + assertNotNull("null problems array", problems); + assertEquals("unexpected problems count", 1, problems.length); + assertEquals("unexpected generated by attribute", "missing", problems[0].getSourceId()); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=158611 +// Checking the GENERATED_BY attribute +public void test1002() throws JavaModelException { + IPath projectPath = env.addProject("Project", "1.5"); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + env.removePackageFragmentRoot(projectPath, ""); + IPath root = env.addPackageFragmentRoot(projectPath, "src"); + env.setOutputFolder(projectPath, "bin"); + env.addClass(root, "p", "X", + "package p;\n" + + "public class X { /* generate problem*/ }" + ); + final String specificGeneratedBy = "specific"; + new BuildTestParticipant() { + public void buildStarting(BuildContext[] files, boolean isBatch) { + for (int i = 0, total = files.length; i < total; i++) { + BuildContext context = files[i]; + if (CharOperation.indexOf("generate problem".toCharArray(), + context.getContents(), true) != -1) { + context.recordNewProblems(new CategorizedProblem[] { + new ParticipantProblem("Participant problem", context.getFile().getFullPath().toString()) { + public String[] getExtraMarkerAttributeNames() { + return new String[] {IMarker.SOURCE_ID}; + } + public Object[] getExtraMarkerAttributeValues() { + return new String[] {specificGeneratedBy}; + } + }}); + } + } + } + }; + fullBuild(projectPath); + Problem[] problems = env.getProblemsFor(projectPath, "org.eclipse.jdt.core.tests.compile.problem"); + assertNotNull("null problems array", problems); + assertEquals("unexpected problems count", 1, problems.length); + assertEquals("unexpected generated by attribute", specificGeneratedBy, problems[0].getSourceId()); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java new file mode 100644 index 0000000000..f2f334876c --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/Problem.java @@ -0,0 +1,145 @@ +/******************************************************************************* + * Copyright (c) 2000, 2015 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.builder; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.IJavaModelMarker; + +@SuppressWarnings("rawtypes") +public class Problem implements Comparable { + private String location; + private String message; + private IPath resourcePath; + private int start = -1, end = -1, categoryId = -1; + private String sourceId; + private int severity = IMarker.SEVERITY_ERROR; + + public Problem(String location, String message, IPath resourcePath, int start, int end, int categoryId, int severity) { + this.location = location; + this.message = message; + this.resourcePath = resourcePath; + this.start = start; + this.end = end; + this.categoryId = categoryId; + this.severity = severity; +// if ((start > 0 || end > 0) && categoryId <= 0) { +// System.out.print("is categoryId properly set ? new Problem(\"" + location + "\", \"" + message + "\", \"" + resourcePath + "\""); +// System.out.print(", " + start + ", " + end + ", " + categoryId); +// System.out.println(")"); +// } + } + + public Problem(IMarker marker){ + this.location = marker.getAttribute(IMarker.LOCATION, ""); //$NON-NLS-1$ + this.message = marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$ + this.resourcePath = marker.getResource().getFullPath(); + this.start = marker.getAttribute(IMarker.CHAR_START, -1); + this.end = marker.getAttribute(IMarker.CHAR_END, -1); + this.categoryId = marker.getAttribute(IJavaModelMarker.CATEGORY_ID, -1); + this.sourceId = marker.getAttribute(IMarker.SOURCE_ID, "missing"); + this.severity = marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_ERROR); + } + public int getCategoryId() { + return this.categoryId; + } + +/** + * Return the IMarker.SOURCE_ID attribute of the underlying marker if any. + * Value null denotes a problem created from explicit structural attributes + * (instead of using a source marker). Value "missing" denotes that the marker + * used to initialize the problem had no IMarker.SOURCE_ID attribute. + * @return the IMarker.SOURCE_ID attribute of the underlying marker if any + */ +public String getSourceId() { + return this.sourceId; +} + /** + * Gets the location. + * @return Returns a String + */ + public String getLocation() { + return this.location; + } + /** + * Gets the message. + * @return Returns a String + */ + public String getMessage() { + return this.message; + } + /** + * Gets the resourcePath. + * @return Returns a IPath + */ + public IPath getResourcePath() { + return this.resourcePath; + } + +public int getSeverity() { + return this.severity; +} + + public int getStart() { + return this.start; + } + + public int getEnd() { + return this.end; + } + + public String toString(){ +// ignore locations since the builder no longer finds exact Java elements +// return "Problem : " + message + " [ resource : <" + resourcePath + "> location <"+ location + "> ]"; + return + "Problem : " + + this.message + + " [ resource : <" + + this.resourcePath + + ">" + + (" range : <" + this.start + "," + this.end + ">") + + (" category : <" + this.categoryId + ">") + + (" severity : <" + this.severity + ">") + + "]"; + } + + public boolean equals(Object o){ + if(o instanceof Problem){ + return toString().equals(o.toString()); + } + return false; + } + + public int compareTo(Object o) { + if(o instanceof Problem){ + Problem problem = (Problem) o; + /* Replace initial implementation with toString() comparison otherwise the problems order may change + * when different VM are used (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=213570)... + if (!(this.getLocation().equals(problem.getLocation()))) { + return this.getLocation().compareTo(problem.getLocation()); + } + if (this.getStart() < problem.getStart()) { + return -1; + } + if (this.getEnd() < problem.getEnd()) { + return -1; + } + return this.getMessage().compareTo(problem.getMessage()); + */ + return toString().compareTo(problem.toString()); + } + return -1; + } +} + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ReferenceCollectionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ReferenceCollectionTest.java new file mode 100644 index 0000000000..c60d73f6b7 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/ReferenceCollectionTest.java @@ -0,0 +1,372 @@ +/******************************************************************************* + * Copyright (c) 2019 Sebastian Zarnekow 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: + * Sebastian Zarnekow - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import static org.junit.Assert.assertArrayEquals; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Collections; + +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.internal.core.builder.ReferenceCollection; + +import junit.framework.Test; + +public class ReferenceCollectionTest extends BuilderTests { + + public ReferenceCollectionTest(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(ReferenceCollectionTest.class); + } + + private static class TestableReferenceCollection extends ReferenceCollection { + /* + Make the package visible fields reflectively available for testing + char[][][] qualifiedNameReferences; + char[][] simpleNameReferences; + char[][] rootReferences; + */ + protected TestableReferenceCollection(char[][][] qualifiedNameReferences, char[][] simpleNameReferences, + char[][] rootReferences) { + super(qualifiedNameReferences, simpleNameReferences, rootReferences); + } + + char[][][] getQualifiedNameReferences() { + try { + Field fld = ReferenceCollection.class.getDeclaredField("qualifiedNameReferences"); + fld.setAccessible(true); + return (char[][][]) fld.get(this); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + char[][] getSimpleNameReferences() { + try { + Field fld = ReferenceCollection.class.getDeclaredField("simpleNameReferences"); + fld.setAccessible(true); + return (char[][]) fld.get(this); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + char[][] getRootReferences() { + try { + Field fld = ReferenceCollection.class.getDeclaredField("rootReferences"); + fld.setAccessible(true); + return (char[][]) fld.get(this); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + } + + public void testInternQualifiedNamesSorts_01() { + char[][][] qualifiedNames = new char[][][] { + CharOperation.splitOn('.', "java.lang.RuntimeException".toCharArray()), + CharOperation.splitOn('.', "a.a.a".toCharArray()), + CharOperation.splitOn('.', "b.b.b".toCharArray()), + CharOperation.splitOn('.', "a.a".toCharArray()), + CharOperation.splitOn('.', "a.b".toCharArray()), + CharOperation.splitOn('.', "com".toCharArray()), + CharOperation.splitOn('.', "a".toCharArray()), + CharOperation.splitOn('.', "b".toCharArray()) + }; + char[][][] expectation = qualifiedNames.clone(); + Collections.shuffle(Arrays.asList(qualifiedNames)); + char[][][] internQualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedNames, true); + assertArrayEquals("Should be sorted, longest first, alphanumeric later", + toStringArray(expectation), + toStringArray(internQualifiedNames)); + } + + public void testInternQualifiedNamesSorts_02() { + char[][][] qualifiedNames = new char[][][] { + CharOperation.splitOn('.', "java.lang.RuntimeException".toCharArray()), + CharOperation.splitOn('.', "a.a.a".toCharArray()), + CharOperation.splitOn('.', "b.b.b".toCharArray()), + CharOperation.splitOn('.', "a.a".toCharArray()), + CharOperation.splitOn('.', "a.b".toCharArray()), + CharOperation.splitOn('.', "com".toCharArray()), + CharOperation.splitOn('.', "a".toCharArray()), + CharOperation.splitOn('.', "b".toCharArray()) + }; + char[][][] expectation = new char[][][] { + CharOperation.splitOn('.', "a.a.a".toCharArray()), + CharOperation.splitOn('.', "b.b.b".toCharArray()), + CharOperation.splitOn('.', "a.a".toCharArray()), + CharOperation.splitOn('.', "a.b".toCharArray()), + CharOperation.splitOn('.', "a".toCharArray()), + CharOperation.splitOn('.', "b".toCharArray()) + }; + Collections.shuffle(Arrays.asList(qualifiedNames)); + char[][][] internQualifiedNames = ReferenceCollection.internQualifiedNames(qualifiedNames, false); + assertArrayEquals("Should be sorted, longest first, alphanumeric later", + toStringArray(expectation), + toStringArray(internQualifiedNames)); + } + + public void testInternSimpleNamesSorts_01() { + char[][] simpleNames = new char[][] { + "Throwable".toCharArray(), + "aaa".toCharArray(), + "bbb".toCharArray(), + "ccc".toCharArray(), + "aa".toCharArray(), + "a".toCharArray() + }; + char[][] expectation = simpleNames.clone(); + Collections.shuffle(Arrays.asList(simpleNames)); + char[][] internSimpleNames = ReferenceCollection.internSimpleNames(simpleNames, false); + assertArrayEquals("Should be sorted, longest first, alphanumeric later", + toStringArray(expectation), + toStringArray(internSimpleNames)); + } + + public void testInternSimpleNamesSorts_02() { + char[][] simpleNames = new char[][] { + "aaa".toCharArray(), + "bbb".toCharArray(), + "Throwable".toCharArray(), + "ccc".toCharArray(), + "java".toCharArray(), + "aa".toCharArray(), + "a".toCharArray() + }; + char[][] expectation = new char[][] { + "aaa".toCharArray(), + "bbb".toCharArray(), + "ccc".toCharArray(), + "aa".toCharArray(), + "a".toCharArray() + }; + Collections.shuffle(Arrays.asList(simpleNames)); + char[][] internSimpleNames = ReferenceCollection.internSimpleNames(simpleNames, true); + assertArrayEquals("Should be sorted, longest first, alphanumeric later", + toStringArray(expectation), + toStringArray(internSimpleNames)); + } + + public void testIncludesWithBinarySearch() { + char[][] simpleNames = ReferenceCollection.internSimpleNames(new char[][] { + "a".toCharArray(), + "b".toCharArray(), + "c".toCharArray(), + "d".toCharArray(), + "e".toCharArray(), + "f".toCharArray(), + "g".toCharArray(), + "h".toCharArray(), + "i".toCharArray(), + "j".toCharArray(), + "k".toCharArray(), + "l".toCharArray(), + "m".toCharArray(), + "n".toCharArray(), + "o".toCharArray(), + "p".toCharArray(), + "q".toCharArray(), + "r".toCharArray(), + "s".toCharArray(), + "t".toCharArray(), + "u".toCharArray(), + "v".toCharArray(), + "w".toCharArray(), + "x".toCharArray(), + "y".toCharArray(), + "z".toCharArray() + }, false); + ReferenceCollection collection = new TestableReferenceCollection(null, simpleNames, null); + for(char[] simpleName: simpleNames) { + assertTrue("Should include " + simpleName[0], collection.includes(simpleName)); + assertFalse("Should not include " + CharOperation.toUpperCase(simpleName)[0], collection.includes(CharOperation.toUpperCase(simpleName))); + } + } + + public void testIncludesWithLinearSearch() { + char[][] simpleNames = ReferenceCollection.internSimpleNames(new char[][] { + "a".toCharArray(), + "b".toCharArray(), + "c".toCharArray(), + "d".toCharArray(), + "e".toCharArray(), + "f".toCharArray(), + "g".toCharArray(), + "h".toCharArray() + }, false); + ReferenceCollection collection = new TestableReferenceCollection(null, simpleNames, null); + for(char[] simpleName: simpleNames) { + assertTrue("Should include " + simpleName[0], collection.includes(simpleName)); + assertFalse("Should not include " + CharOperation.toUpperCase(simpleName)[0], collection.includes(CharOperation.toUpperCase(simpleName))); + } + } + + public void testIncludes01() { + TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); + + String[] array = new String[] { "a.a", "b.a", "b.b" }; + refColl.addDependencies(array); + + TestableReferenceCollection other = new TestableReferenceCollection(null, null, null); + String[] array2 = new String[] { "a.a", "B.A", "b.b" }; + other.addDependencies(array2); + + assertTrue(refColl.includes(other.getQualifiedNameReferences(), other.getSimpleNameReferences(), other.getRootReferences())); + assertTrue(other.includes(refColl.getQualifiedNameReferences(), refColl.getSimpleNameReferences(), refColl.getRootReferences())); + } + + public void testIncludes02() { + TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); + + String[] array = new String[] { "a.x", "b.y" }; + refColl.addDependencies(array); + + TestableReferenceCollection other = new TestableReferenceCollection(null, null, null); + String[] array2 = new String[] { "a.y", "b.x" }; + other.addDependencies(array2); + + assertTrue(refColl.includes(other.getQualifiedNameReferences(), other.getSimpleNameReferences(), other.getRootReferences())); + assertTrue(other.includes(refColl.getQualifiedNameReferences(), refColl.getSimpleNameReferences(), refColl.getRootReferences())); + } + + public void testIncludes03() { + TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); + + String[] array = new String[] { "a.d.y", "c.x" }; + refColl.addDependencies(array); + + TestableReferenceCollection other = new TestableReferenceCollection(null, null, null); + String[] array2 = new String[] { "c.y" }; + other.addDependencies(array2); + + assertTrue(refColl.includes(other.getQualifiedNameReferences(), other.getSimpleNameReferences(), other.getRootReferences())); + assertTrue(other.includes(refColl.getQualifiedNameReferences(), refColl.getSimpleNameReferences(), refColl.getRootReferences())); + } + + public void testIncludes04() { + TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); + + String[] array = new String[] { "a.d.y" }; + refColl.addDependencies(array); + + TestableReferenceCollection other = new TestableReferenceCollection(null, null, null); + String[] array2 = new String[] { "a.d" }; + other.addDependencies(array2); + + assertTrue(refColl.includes(other.getQualifiedNameReferences(), other.getSimpleNameReferences(), other.getRootReferences())); + assertTrue(other.includes(refColl.getQualifiedNameReferences(), refColl.getSimpleNameReferences(), refColl.getRootReferences())); + } + + public void testIncludesNot() { + TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); + + String[] array = new String[] {"b.a"}; + refColl.addDependencies(array); + + TestableReferenceCollection other = new TestableReferenceCollection(null, null, null); + String[] array2 = new String[] {"B.A"}; + other.addDependencies(array2); + + assertFalse(refColl.includes(other.getQualifiedNameReferences(), other.getSimpleNameReferences(), other.getRootReferences())); + assertFalse(other.includes(refColl.getQualifiedNameReferences(), refColl.getSimpleNameReferences(), refColl.getRootReferences())); + } + + public void testAddDependencies() { + TestableReferenceCollection refColl = new TestableReferenceCollection(null, null, null); + + String[] array = new String[] {"a.b.c.D"}; + refColl.addDependencies(array); + + char[][][] qualifiedNameReferences = refColl.getQualifiedNameReferences(); + String [] strings = toStringArray(qualifiedNameReferences); + assertArrayEquals(new String[] { + "a.b.c.D", + "a.b.c", + "a.b", + "a" + }, strings); + + char[][] simpleNameReferences = refColl.getSimpleNameReferences(); + assertArrayEquals(new String[] { + "D", + "a", + "b", + "c" + }, CharOperation.toStrings(simpleNameReferences)); + + char[][] rootReferences = refColl.getRootReferences(); + assertArrayEquals(new String[] { + "a" + }, CharOperation.toStrings(rootReferences)); + } + + private static String[] toStringArray(char[][][] qualifiedNameReferences) { + return Arrays.stream(qualifiedNameReferences).map(a -> CharOperation.toString(a)).toArray(String[]::new); + } + + private static String[] toStringArray(char[][] qualifiedNameReferences) { + return Arrays.stream(qualifiedNameReferences).map(a -> CharOperation.charToString(a)).toArray(String[]::new); + } + + public void testRegression01() { + char[][][] qualifiedNames = new char[][][] { + CharOperation.splitOn('.', "p1.IX".toCharArray()), + CharOperation.splitOn('.', "p2.X".toCharArray()) + }; + char[][] simpleNames = new char[][] { + "I__X".toCharArray(), "IX".toCharArray(), "p1".toCharArray(), "p2".toCharArray(), "X".toCharArray() + }; + char[][] rootNames = new char[][] { + "java".toCharArray(), "IX".toCharArray(), "p1".toCharArray(), "p2".toCharArray() + }; + ReferenceCollection collection = new TestableReferenceCollection(qualifiedNames, simpleNames, rootNames); + qualifiedNames = ReferenceCollection.internQualifiedNames(new char[][][] { + CharOperation.splitOn('.', "p2".toCharArray()) + }); + simpleNames = ReferenceCollection.internSimpleNames(new char[][] { + "X".toCharArray() + }, true); + rootNames = ReferenceCollection.internSimpleNames(new char[][] { + "p2".toCharArray() + }, false); + + assertTrue("Should include", collection.includes(qualifiedNames, simpleNames, rootNames)); + } + + public void testRegression02() { + char[][][] qualifiedNames = new char[][][] {}; + char[][] simpleNames = new char[][] { + "GeneratedAnnotation".toCharArray(), "Test".toCharArray() + }; + char[][] rootNames = new char[][] { + "java".toCharArray(), "GeneratedAnnotation".toCharArray() + }; + ReferenceCollection collection = new TestableReferenceCollection(qualifiedNames, simpleNames, rootNames); + + qualifiedNames = null; + simpleNames = ReferenceCollection.internSimpleNames(new char[][] { + "GeneratedAnnotation".toCharArray() + }, true); + rootNames = ReferenceCollection.internSimpleNames(new char[][] { + "GeneratedAnnotation".toCharArray() + }, false); + + assertTrue("Should include", collection.includes(qualifiedNames, simpleNames, rootNames)); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StateTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StateTest.java new file mode 100644 index 0000000000..54e06cd4de --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StateTest.java @@ -0,0 +1,357 @@ +/******************************************************************************* + * Copyright (c) 2019 Sebastian Zarnekow 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: + * Sebastian Zarnekow - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import static org.junit.Assert.assertArrayEquals; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Map; +import java.util.Set; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IncrementalProjectBuilder; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.jdt.core.IAccessRule; +import org.eclipse.jdt.core.IClasspathAttribute; +import org.eclipse.jdt.core.IClasspathEntry; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.JavaCore; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.core.JavaModelManager; +import org.eclipse.jdt.internal.core.JavaModelManager.PerProjectInfo; +import org.eclipse.jdt.internal.core.builder.ClasspathLocation; +import org.eclipse.jdt.internal.core.builder.JavaBuilder; +import org.eclipse.jdt.internal.core.builder.ReferenceCollection; +import org.eclipse.jdt.internal.core.builder.State; + +import junit.framework.Test; + +public class StateTest extends BuilderTests { + + public StateTest(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(StateTest.class); + } + + public void testWriteAndReadState() throws JavaModelException, Exception { + IPath interfaceProjectPath = env.addProject("Interface"); //$NON-NLS-1$ + env.addExternalJars(interfaceProjectPath, Util.getJavaClassLibs()); + + IPath implementationProjectPath = env.addProject("Implementation"); //$NON-NLS-1$ + env.addExternalJars(implementationProjectPath, Util.getJavaClassLibs()); + env.addClassFolder(implementationProjectPath, interfaceProjectPath, false); + + env.addClass(interfaceProjectPath, "a", "Interfaze", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "public interface Interfaze {\n" + + " void callMe();\n" + + "}" //$NON-NLS-1$ + ); + + env.addClass(interfaceProjectPath, "c", "Impl1", //$NON-NLS-1$ //$NON-NLS-2$ + "package c;\n" + + "import a.Interfaze;\n" + + "public class Impl1 implements Interfaze {\n" + + " @Override\n" + + " public void callMe() {\n" + + " }\n" + + "}" + ); + + env.addClass(implementationProjectPath, "b", "Impl2", //$NON-NLS-1$ //$NON-NLS-2$ + "package b;\n" + + "import a.Interfaze;\n" + + "public class Impl2 implements Interfaze {\n" + + " @Override\n" + + " public void callMe() {\n" + + " }\n" + + "}" //$NON-NLS-1$ + ); + fullBuild(); + + writeReadAndCompareReferences(interfaceProjectPath); + writeReadAndCompareReferences(implementationProjectPath); + } + + + public void testBug563546() throws JavaModelException, Exception { + IPath project = env.addProject("Bug563546"); //$NON-NLS-1$ + env.addExternalJars(project, Util.getJavaClassLibs()); + + env.addClass(project, "a", "WithOther", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "class Other {\n" + + "}\n" + + "public class WithOther {\n" + + "}" //$NON-NLS-1$ + ); + fullBuild(); + env.removePackage(project, "a"); + incrementalBuild(); + + writeReadAndCompareReferences(project); + } + + public void testBug567532() throws JavaModelException, Exception { + IPath project = env.addProject("Bug567532"); //$NON-NLS-1$ + String[] classLibs = Util.getJavaClassLibs(); + for (String jar : classLibs) { + env.addEntry(project, + JavaCore.newLibraryEntry( + new Path(jar), + null, + null, + new IAccessRule[0], + new IClasspathAttribute[] { + JavaCore.newClasspathAttribute(IClasspathAttribute.TEST, "true"), + JavaCore.newClasspathAttribute(IClasspathAttribute.ADD_EXPORTS, + "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED") }, + false)); + } + + env.addClass(project, "a", "WithOther", //$NON-NLS-1$ //$NON-NLS-2$ + "package a;\n" + + "class Other {\n" + + "}\n" + + "public class WithOther {\n" + + "}" //$NON-NLS-1$ + ); + fullBuild(); + env.removePackage(project, "a"); + incrementalBuild(); + + writeReadAndCompareTestBinaryLocations(project); + } + public void testSelfAnnotatedJars() throws CoreException, IOException { + // derived from the same named test in ExternalAnnotation18Test: + IPath projectPath = env.addProject("PrjTest", "1.8"); //$NON-NLS-1$ + IJavaProject project = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(projectPath.segment(0))); + + project.setOption(JavaCore.CORE_JAVA_BUILD_EXTERNAL_ANNOTATIONS_FROM_ALL_LOCATIONS, JavaCore.ENABLED); + + String projectLoc = project.getProject().getLocation().toString(); + Util.createJar(new String[] { + "pgen/CGen.java", + "package pgen;\n" + + "public class CGen {\n" + + " public String get(String in) { return in; }\n" + + "}\n" + }, + new String[] { + "pgen/CGen.eea", + "class pgen/CGen\n" + + "\n" + + "get\n" + + " (Ljava/lang/String;)Ljava/lang/String;\n" + + " (L1java/lang/String;)L1java/lang/String;\n" + }, + projectLoc+"/lib/prj1.jar", + "1.8"); + IClasspathEntry entry = JavaCore.newLibraryEntry( + new Path("/PrjTest/lib/prj1.jar"), + null/*access rules*/, + null, + false/*exported*/); + env.addEntry(project.getPath(), entry); + + Util.createJar(new String[] { + "pgen2/CGen2.java", + "package pgen2;\n" + + "public class CGen2 {\n" + + " public String get2(Exception in) { return in.toString(); }\n" + + "}\n" + }, + new String[] { + "pgen2/CGen2.eea", + "class pgen2/CGen2\n" + + "\n" + + "get2\n" + + " (Ljava/lang/Exception;)Ljava/lang/String;\n" + + " (L1java/lang/Exception;)L1java/lang/String;\n", + }, + projectLoc+"/lib/prj2.jar", + "1.8"); + entry = JavaCore.newLibraryEntry( + new Path("/PrjTest/lib/prj2.jar"), + null/*access rules*/, + null, + false/*exported*/); + env.addEntry(project.getPath(), entry); + project.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); + + env.addFolder(project.getPath(), "src/p"); + env.addFile(project.getPath().append("src").append("p"), "Use.java", + "package p;\n" + + "import pgen.CGen;\n" + + "import pgen2.CGen2;\n" + + "import org.eclipse.jdt.annotation.NonNull;\n" + + "public class Use {\n" + + " public @NonNull String test(CGen c) {\n" + + " String s = c.get(null);\n" + + " return s;\n" + + " }\n" + + " public @NonNull String test2(CGen2 c) {\n" + + " String s = c.get2(null);\n" + + " return s;\n" + + " }\n" + + "}\n"); + project.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null); + writeReadAndCompareExternalAnnotationLocations(project.getProject()); + } + + private void writeReadAndCompareTestBinaryLocations(IPath projectPath) + throws JavaModelException, IOException, CoreException { + JavaModelManager javaModelManager = JavaModelManager.getJavaModelManager(); + IProject project = env.getProject(projectPath); + PerProjectInfo info = javaModelManager.getPerProjectInfoCheckExistence(project); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + State savedState = (State) info.savedState; + JavaBuilder.writeState(savedState, new DataOutputStream(outputStream)); + byte[] bytes = outputStream.toByteArray(); + State readState = JavaBuilder.readState(project, new DataInputStream(new ByteArrayInputStream(bytes))); + assertEqualBinaryLocations(savedState.testBinaryLocations, readState.testBinaryLocations); + + assertEquals(readState, savedState); + } + + private void assertEqualBinaryLocations(ClasspathLocation[] a, + ClasspathLocation[] b) { + assertEquals(a.length, b.length); + assertArrayEquals(a, b); + } + + private void writeReadAndCompareExternalAnnotationLocations(IProject project) + throws JavaModelException, IOException, CoreException { + JavaModelManager javaModelManager = JavaModelManager.getJavaModelManager(); + PerProjectInfo info = javaModelManager.getPerProjectInfoCheckExistence(project); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + State savedState = (State) info.savedState; + JavaBuilder.writeState(savedState, new DataOutputStream(outputStream)); + byte[] bytes = outputStream.toByteArray(); + State readState = JavaBuilder.readState(project, new DataInputStream(new ByteArrayInputStream(bytes))); + assertArrayEquals(savedState.binaryLocations, readState.binaryLocations); + // beyond this point we know that both arrays have the same length + for (int i=0; i < savedState.binaryLocations.length; i++) { + assertTrue("comparing eea locations of "+savedState.binaryLocations[i], savedState.binaryLocations[i].externalAnnotationsEquals(readState.binaryLocations[i])); + } + + assertEquals(readState, savedState); + } + + private void writeReadAndCompareReferences(IPath projectPath) + throws JavaModelException, IOException, CoreException { + JavaModelManager javaModelManager = JavaModelManager.getJavaModelManager(); + IProject project = env.getProject(projectPath); + PerProjectInfo info = javaModelManager.getPerProjectInfoCheckExistence(project); + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + State savedState = (State) info.savedState; + JavaBuilder.writeState(savedState, new DataOutputStream(outputStream)); + byte[] bytes = outputStream.toByteArray(); + State readState = JavaBuilder.readState(project, new DataInputStream(new ByteArrayInputStream(bytes))); + Map readReferences = readState.getReferences(); + assertEqualLookupTables(savedState.getReferences(), readReferences); + assertEqualTypeLocators(savedState.typeLocators, readState.typeLocators); + + assertEquals(readState, savedState); + } + + private void assertEqualTypeLocators(Map tl1, Map tl2) { + assertEquals(tl1.size(), tl2.size()); + assertEquals(tl1.toString(), tl2.toString()); + + } + + private void assertEqualLookupTables(Map expectation, Map actual) { + assertEquals(expectation.size(), actual.size()); + Set expectedKeys = expectation.keySet(); + for (String key : expectedKeys) { + ReferenceCollection actualReferenceCollection = actual.get(key); + ReferenceCollection expectedReferenceCollection = expectation.get(key); + assertEqualReferenceCollections(expectedReferenceCollection, actualReferenceCollection); + } + } + + private void assertEqualReferenceCollections(ReferenceCollection expectedReferenceCollection, + ReferenceCollection actualReferenceCollection) { + { + char[][] expected = getSimpleNameReferences(expectedReferenceCollection); + char[][] actual = getSimpleNameReferences(actualReferenceCollection); + assertArrayEquals(toStringArray(expected), toStringArray(actual)); + } + { + char[][] expected = getRootReferences(expectedReferenceCollection); + char[][] actual = getRootReferences(actualReferenceCollection); + assertArrayEquals(toStringArray(expected), toStringArray(actual)); + } + { + char[][][] expected = getQualifiedNameReferences(expectedReferenceCollection); + char[][][] actual = getQualifiedNameReferences(actualReferenceCollection); + assertArrayEquals(toStringArray(expected), toStringArray(actual)); + } + } + + private static String[] toStringArray(char[][][] qualifiedNameReferences) { + return Arrays.stream(qualifiedNameReferences).map(a -> CharOperation.toString(a)).toArray(String[]::new); + } + + private static String[] toStringArray(char[][] qualifiedNameReferences) { + return Arrays.stream(qualifiedNameReferences).map(a -> CharOperation.charToString(a)).toArray(String[]::new); + } + + char[][][] getQualifiedNameReferences(ReferenceCollection collection) { + try { + Field fld = ReferenceCollection.class.getDeclaredField("qualifiedNameReferences"); + fld.setAccessible(true); + return (char[][][]) fld.get(collection); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + char[][] getSimpleNameReferences(ReferenceCollection collection) { + try { + Field fld = ReferenceCollection.class.getDeclaredField("simpleNameReferences"); + fld.setAccessible(true); + return (char[][]) fld.get(collection); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + char[][] getRootReferences(ReferenceCollection collection) { + try { + Field fld = ReferenceCollection.class.getDeclaredField("rootReferences"); + fld.setAccessible(true); + return (char[][]) fld.get(collection); + } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java new file mode 100644 index 0000000000..7a6f77556a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/StaticFinalTests.java @@ -0,0 +1,318 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.builder; + +import junit.framework.*; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; + +public class StaticFinalTests extends BuilderTests { + + public StaticFinalTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(StaticFinalTests.class); + } + + public void testBoolean() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final boolean VAR = true; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "true", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final boolean VAR = false; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "false", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testByte() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final byte VAR = (byte) 0; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "0", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final byte VAR = (byte) 1; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "1", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testChar() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final String VAR = \"Hello\"; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "Hello", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final String VAR = \"Bye\"; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "Bye", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testDouble() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final double VAR = (double) 2; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "2", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final double VAR = (double) 3; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "3", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testFloat() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final float VAR = (float) 4; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "4", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final float VAR = (float) 5; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "5", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testInt() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final int VAR = (int) 6; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "6", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final int VAR = (int) 7; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "7", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testLong() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final long VAR = (long) 8; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "8", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final long VAR = (long) 9; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "9", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testShort() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final short VAR = (short) 10; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "10", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final short VAR = (short) 11; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "11", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + public void testString() throws JavaModelException { + IPath projectPath = env.addProject("Project"); //$NON-NLS-1$ + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final String VAR = \"Hello\"; }" //$NON-NLS-1$ + ); + + env.addClass(projectPath, "p1", "Main", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class Main {\n" + //$NON-NLS-1$ + " public static void main(String args[]) {\n"+ //$NON-NLS-1$ + " System.out.println(A.VAR);\n"+ //$NON-NLS-1$ + " }\n"+ //$NON-NLS-1$ + "}\n" //$NON-NLS-1$ + ); + + fullBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "Hello", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + env.addClass(projectPath, "p1", "A", //$NON-NLS-1$ //$NON-NLS-2$ + "package p1;\n" + //$NON-NLS-1$ + "public class A { public static final String VAR = \"Bye\"; }" //$NON-NLS-1$ + ); + + incrementalBuild(); + expectingNoProblems(); + executeClass(projectPath, "p1.Main", "Bye", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java new file mode 100644 index 0000000000..140ddd944b --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestAttributeBuilderTests.java @@ -0,0 +1,905 @@ +/******************************************************************************* + * Copyright (c) 2017, 2018 Till Brychcy 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: + * Till Brychcy - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.builder; + +import java.util.HashMap; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.tests.util.Util; +import junit.framework.Test; + +public class TestAttributeBuilderTests extends BuilderTests { + static { + // TESTS_NAMES = new String[] { "testIncrementalBuildTestOnlyProject" }; + } + + + public TestAttributeBuilderTests(String name) { + super(name); + } + + public static Test suite() { + return buildTestSuite(TestAttributeBuilderTests.class); + } + + public void testWithProjectAsMainDependency() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + env.addClass(src1, "p1", "Production1", + "package p1;\n" + + "\n" + + "public class Production1 {\n" + + " void p1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class {\n"+ + "}\n" + ); + env.addClass(src2, "p2", "Production2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Production2 {\n" + + " void p2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " new T2Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // ok\n" + + " new T2Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <144,151> category : <40> severity : <2>]\n" + + "Problem : T2Class cannot be resolved to a type [ resource : range : <174,181> category : <40> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]"); + } + public void testWithProjectAsTestDependency() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + env.addClass(src1, "p1", "Production1", + "package p1;\n" + + "\n" + + "public class Production1 {\n" + + " void p1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredTestProject(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class {\n"+ + "}\n" + ); + env.addClass(src2, "p2", "Production2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Production2 {\n" + + " void p2() {\n" + + " new P1Class(); // forbidden\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " new T2Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // ok\n" + + " new T2Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : P1Class cannot be resolved to a type [ resource : range : <98,105> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <151,158> category : <40> severity : <2>]\n" + + "Problem : T2Class cannot be resolved to a type [ resource : range : <181,188> category : <40> severity : <2>]\n" + + "Problem : The import p1 cannot be resolved [ resource : range : <20,22> category : <30> severity : <2>]\n" + + "Problem : The import p1 cannot be resolved [ resource : range : <39,41> category : <30> severity : <2>]"); + } + public void testWithProjectAsMainDependencyWithoutTestCode() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + env.addClass(src1, "p1", "Production1", + "package p1;\n" + + "\n" + + "public class Production1 {\n" + + " void p1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProjectWithoutTestCode(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class {\n"+ + "}\n" + ); + env.addClass(src2, "p2", "Production2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Production2 {\n" + + " void p2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " new T2Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // ok\n" + + " new T2Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <144,151> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <141,148> category : <40> severity : <2>]\n" + + "Problem : T2Class cannot be resolved to a type [ resource : range : <174,181> category : <40> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]"); + } + public void testWithProjectAsTestDependencyWithoutTestCode() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + env.addClass(src1, "p1", "Production1", + "package p1;\n" + + "\n" + + "public class Production1 {\n" + + " void p1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredTestProjectWithoutTestCode(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class {\n"+ + "}\n" + ); + env.addClass(src2, "p2", "Production2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Production2 {\n" + + " void p2() {\n" + + " new P1Class(); // forbidden\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " new T2Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // ok\n" + + " new T2Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : P1Class cannot be resolved to a type [ resource : range : <98,105> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <151,158> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <141,148> category : <40> severity : <2>]\n" + + "Problem : T2Class cannot be resolved to a type [ resource : range : <181,188> category : <40> severity : <2>]\n" + + "Problem : The import p1 cannot be resolved [ resource : range : <20,22> category : <30> severity : <2>]\n" + + "Problem : The import p1 cannot be resolved [ resource : range : <39,41> category : <30> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]"); + } + + public void testIncrementalBuildMainChange() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "class P1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class extends P1Class {\n"+ + "}\n" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class extends p1.P1Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new P2Class();\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : The type p1.P1Class is not visible [ resource : range : <42,52> category : <40> severity : <2>]"); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + incrementalBuild(); + expectingNoProblems(); + expectingCompiledClasses(new String[] { "p1.P1Class", "p1.T1Class", "p2.P2Class", "p2.Test2" }); + expectingCompilingOrder(new String[] { "/Project1/src/p1/P1Class.java", "/Project1/tests/p1/T1Class.java", + "/Project2/src/p2/P2Class.java", "/Project2/tests/p2/Test2.java" }); + } + public void testIncrementalBuildTestChange() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new P1Class();" + + " new T1Class();" + + " }\n" + + "}\n" + + "" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class extends p1.P1Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class extends p1.T1Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "public class Test2 extends p2.T2Class {\n" + + " void test2(T2Class t) {\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingNoProblems(); + + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class extends P1Class {\n"+ + "}\n" + ); + incrementalBuild(); + expectingNoProblems(); + expectingCompiledClasses(new String[] { "p1.T1Class", "p1.Test1", "p2.T2Class", "p2.Test2" }); + expectingCompilingOrder(new String[] { "/Project1/tests/p1/T1Class.java", "/Project1/tests/p1/Test1.java", + "/Project2/tests/p2/T2Class.java", "/Project2/tests/p2/Test2.java" }); + } + + public void testIncrementalBuildTestOnlyProject() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new T1Class();" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingNoProblems(); + + IPath test1 = env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new X1Class();" + + " }\n" + + "}\n" + + "" + ); + incrementalBuild(); + expectingProblemsFor( + test1, + "Problem : X1Class cannot be resolved to a type [ resource : range : <56,63> category : <40> severity : <2>]" + ); + expectingCompiledClasses(new String[] { "p1.Test1" }); + expectingCompilingOrder(new String[] { "/Project1/tests/p1/Test1.java"}); + } + + public void testClasspathEntryTestAttributeChanges() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(src1, "p1", "P1Class", + "package p1;\n" + + "\n" + + "public class P1Class {\n"+ + "}\n" + ); + env.addClass(src1, "p1", "P1Unrelated", + "package p1;\n" + + "\n" + + "public class P1Unrelated {\n"+ + "}\n" + ); + env.addClass(src1, "p1", "Production1", + "package p1;\n" + + "\n" + + "public class Production1 {\n" + + " void p1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new P1Class(); // ok\n" + + " new T1Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath src2 = env.addPackageFragmentRoot(project2Path, "src", null, "bin"); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, project1Path); + env.addClass(src2, "p2", "P2Class", + "package p2;\n" + + "\n" + + "public class P2Class {\n"+ + "}\n" + ); + env.addClass(src1, "p2", "P2Unrelated", + "package p2;\n" + + "\n" + + "public class P2Unrelated {\n"+ + "}\n" + ); + env.addClass(src2, "p2", "Production2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Production2 {\n" + + " void p2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // forbidden\n" + + " new T2Class(); // forbidden\n" + + " }\n" + + "}\n" + + "" + ); + env.addClass(tests2, "p2", "T2Class", + "package p2;\n" + + "\n" + + "public class T2Class {\n"+ + "}\n" + ); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "import p1.P1Class;\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new P1Class(); // ok\n" + + " new P2Class(); // ok\n" + + " new T1Class(); // ok\n" + + " new T2Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <144,151> category : <40> severity : <2>]\n" + + "Problem : T2Class cannot be resolved to a type [ resource : range : <174,181> category : <40> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]"); + + env.changePackageFragmentRootTestAttribute(project2Path, tests2, false); + incrementalBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <144,151> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <141,148> category : <40> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]"); + expectingCompiledClasses(new String[]{"p2.P2Class","p2.Production2","p2.T2Class","p2.Test2"}); + + env.changePackageFragmentRootTestAttribute(project1Path, tests1, false); + incrementalBuild(); + expectingNoProblems(); + expectingCompiledClasses(new String[]{"p1.P1Class", "p1.P1Unrelated","p1.Production1","p1.T1Class","p1.Test1","p2.P2Class","p2.P2Unrelated","p2.Production2","p2.T2Class","p2.Test2"}); + + env.changePackageFragmentRootTestAttribute(project2Path, tests2, true); + incrementalBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T2Class cannot be resolved to a type [ resource : range : <174,181> category : <40> severity : <2>]"); + expectingCompiledClasses(new String[]{"p2.P2Class","p2.Production2","p2.T2Class","p2.Test2"}); + + env.changePackageFragmentRootTestAttribute(project1Path, tests1, true); + incrementalBuild(); + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T1Class cannot be resolved to a type [ resource : range : <82,89> category : <40> severity : <2>]\n" + + "Problem : T1Class cannot be resolved to a type [ resource : range : <144,151> category : <40> severity : <2>]\n" + + "Problem : T2Class cannot be resolved to a type [ resource : range : <174,181> category : <40> severity : <2>]\n" + + "Problem : The import p1.T1Class cannot be resolved [ resource : range : <39,49> category : <30> severity : <2>]"); + expectingCompiledClasses(new String[]{"p1.P1Class", "p1.P1Unrelated","p1.Production1","p1.T1Class","p1.Test1","p2.P2Class","p2.P2Unrelated","p2.Production2","p2.T2Class","p2.Test2"}); + + env.changePackageFragmentRootTestAttribute(project2Path, tests2, false); + env.changePackageFragmentRootTestAttribute(project1Path, tests1, false); + incrementalBuild(); + expectingNoProblems(); + expectingCompiledClasses(new String[]{"p1.P1Class", "p1.P1Unrelated","p1.Production1","p1.T1Class","p1.Test1","p2.P2Class","p2.P2Unrelated","p2.Production2","p2.T2Class","p2.Test2"}); + } + + public void testExternalTestJarChanged() throws CoreException, java.io.IOException { + IPath projectPath = env.addProject("Project"); + env.removePackageFragmentRoot(projectPath, ""); + env.addExternalJars(projectPath, Util.getJavaClassLibs()); + + IPath tests = env.addTestPackageFragmentRoot(projectPath, "tests"); + IPath classTest = env.addClass(tests, "p", "X", + "package p;\n"+ + "public class X {\n" + + " void foo() {\n" + + " new q.Y().bar();\n" + + " }\n" + + "}" + ); + String externalJar = Util.getOutputDirectory() + java.io.File.separator + "test.jar"; + Util.createJar( + new String[] { + "q/Y.java", + "package q;\n" + + "public class Y {\n" + + "}" + }, + new HashMap<>(), + externalJar + ); + fullBuild(); + expectingProblemsFor( + classTest, + "Problem : q cannot be resolved to a type [ resource : range : <51,52> category : <40> severity : <2>]" + ); + env.addExternalTestJar(projectPath, externalJar, false); + + incrementalBuild(); + expectingProblemsFor( + classTest, + "Problem : The method bar() is undefined for the type Y [ resource : range : <57,60> category : <50> severity : <2>]" + ); + + Util.createJar( + new String[] { + "q/Y.java", + "package q;\n" + + "public class Y {\n" + + " public void bar() {\n" + + " }\n" + + "}" + }, + new HashMap<>(), + externalJar + ); + + env.getProject(projectPath).touch(null); + + incrementalBuild(); + expectingNoProblems(); + } + + public void testBug536868() throws JavaModelException { + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + + // project X just reexports Project1 without test code + IPath projectXPath = env.addProject("ProjectX"); + env.removePackageFragmentRoot(projectXPath, ""); + env.addRequiredProjectWithoutTestCode(projectXPath, project1Path, /* isExported */ true); + + + IPath project2Path = env.addProject("Project2"); + env.removePackageFragmentRoot(project2Path, ""); + IPath tests2 = env.addTestPackageFragmentRoot(project2Path, "tests"); + env.addExternalJars(project2Path, Util.getJavaClassLibs()); + env.addRequiredProject(project2Path, projectXPath); + env.addRequiredTestProject(project2Path, project1Path); + env.addClass(tests2, "p2", "Test2", + "package p2;\n" + + "\n" + + "import p1.T1Class;\n" + + "\n" + + "public class Test2 {\n" + + " void test2() {\n" + + " new T1Class(); // ok\n" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingNoProblems(); + } + public void testBug559965() throws JavaModelException { + // Bug 559965 - No recompilation when deleting java file from test-source-folder + IPath project1Path = env.addProject("Project1"); + env.removePackageFragmentRoot(project1Path, ""); + IPath src1 = env.addPackageFragmentRoot(project1Path, "src", null, "bin"); + assertNotNull(src1); + + IPath tests1 = env.addTestPackageFragmentRoot(project1Path, "tests"); + env.addExternalJars(project1Path, Util.getJavaClassLibs()); + + env.addClass(tests1, "p1", "T1Class", + "package p1;\n" + + "\n" + + "public class T1Class {\n"+ + "}\n" + ); + env.addClass(tests1, "p1", "Test1", + "package p1;\n" + + "\n" + + "public class Test1 {\n" + + " void test1() {\n" + + " new T1Class();" + + " }\n" + + "}\n" + + "" + ); + + fullBuild(); + expectingNoProblems(); + + env.removeClass(tests1, "p1/T1Class"); + incrementalBuild(); + + expectingProblemsFor(env.getWorkspaceRootPath(), "Problem : T1Class cannot be resolved to a type [ resource : range : <56,63> category : <40> severity : <2>]"); + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestBuilderParticipant.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestBuilderParticipant.java new file mode 100644 index 0000000000..92e5088e9e --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestBuilderParticipant.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 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.builder; + +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.core.compiler.*; + +public class TestBuilderParticipant extends CompilationParticipant { + + public static CompilationParticipant PARTICIPANT; + +public int aboutToBuild(IJavaProject project) { + return PARTICIPANT.aboutToBuild(project); +} + +public void buildFinished(IJavaProject project) { + PARTICIPANT.buildFinished(project); +} + +public void buildStarting(BuildContext[] files, boolean isBatchBuild) { + PARTICIPANT.buildStarting(files, isBatchBuild); +} + +public void cleanStarting(IJavaProject project) { + PARTICIPANT.cleanStarting(project); +} + +public boolean isActive(IJavaProject project) { + return PARTICIPANT != null; +} + +public boolean isAnnotationProcessor() { + return PARTICIPANT != null && PARTICIPANT.isAnnotationProcessor(); +} + +public void processAnnotations(BuildContext[] files) { + PARTICIPANT.processAnnotations(files); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java new file mode 100644 index 0000000000..c24844ccd5 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java @@ -0,0 +1,1243 @@ +/******************************************************************************* + * 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 + * 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.builder; + +import org.eclipse.core.resources.*; +import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.jobs.Job; + +import org.eclipse.jdt.core.*; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; + +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.core.ClasspathEntry; +import org.eclipse.jdt.internal.core.JavaModelManager; +import org.eclipse.jdt.internal.core.JavaProject; + +import java.io.*; +import java.util.*; + +public class TestingEnvironment { + + private boolean isOpen = false; + + private IWorkspace workspace = null; + private Hashtable projects = null; + + private void addBuilderSpecs(String projectName) { + try { + IProject project = getProject(projectName); + IProjectDescription description = project.getDescription(); + description.setNatureIds(new String[] { JavaCore.NATURE_ID }); + project.setDescription(description, null); + } catch (CoreException e) { + handleCoreException(e); + } + } + + /** Adds a binary class with the given contents to the + * given package in the workspace. The package is created + * if necessary. If a class with the same name already + * exists, it is replaced. A workspace must be open, + * and the given class name must not end with ".class". + * Returns the path of the added class. + */ + public IPath addBinaryClass(IPath packagePath, String className, byte[] contents) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath classPath = packagePath.append(className + ".class"); //$NON-NLS-1$ + createFile(classPath, contents); + return classPath; + } + + /** Adds a binary class with the given contents to the + * given package in the workspace. The package is created + * if necessary. If a class with the same name already + * exists, it is replaced. A workspace must be open, + * and the given class name must not end with ".class". + * Returns the path of the added class. + */ + public IPath addBinaryClass(IPath packageFragmentRootPath, String packageName, String className, byte[] contents) { + /* make sure the package exists */ + if(packageName != null && packageName.length() >0){ + IPath packagePath = addPackage(packageFragmentRootPath, packageName); + + return addBinaryClass(packagePath, className, contents); + } + return addBinaryClass(packageFragmentRootPath, className, contents); + + } + + /** Adds a class with the given contents to the given + * package in the workspace. The package is created + * if necessary. If a class with the same name already + * exists, it is replaced. A workspace must be open, + * and the given class name must not end with ".java". + * Returns the path of the added class. + */ + public IPath addClass(IPath packagePath, String className, String contents) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath classPath = packagePath.append(className + ".java"); //$NON-NLS-1$ + try { + createFile(classPath, contents.getBytes("UTF8")); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + checkAssertion("e1", false); //$NON-NLS-1$ + } + return classPath; + } + + /** Adds a class with the given contents to the given + * package in the workspace. The package is created + * if necessary. If a class with the same name already + * exists, it is replaced. A workspace must be open, + * and the given class name must not end with ".java". + * Returns the path of the added class. + */ + public IPath addClass(IPath packageFragmentRootPath, String packageName, String className, String contents) { + /* make sure the package exists */ + if(packageName != null && packageName.length() >0){ + IPath packagePath = addPackage(packageFragmentRootPath, packageName); + + return addClass(packagePath, className, contents); + } + return addClass(packageFragmentRootPath, className, contents); + } + +/** + * Add a class folder to the classpath of a project. + */ +public void addClassFolder(IPath projectPath, IPath classFolderPath, boolean isExported) throws JavaModelException { + addEntry(projectPath, JavaCore.newLibraryEntry(classFolderPath, null, null, isExported)); +} + + /** Adds a package to the given package fragment root + * in the workspace. The package fragment root is created + * if necessary. If a package with the same name already + * exists, it is not replaced. A workspace must be open. + * Returns the path of the added package. + */ + public IPath addPackage(IPath packageFragmentRootPath, String packageName) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath path = + packageFragmentRootPath.append(packageName.replace('.', IPath.SEPARATOR)); + createFolder(path); + return path; + } + + public IPath addPackageFragmentRoot(IPath projectPath, String sourceFolderName) throws JavaModelException { + return addPackageFragmentRoot(projectPath, sourceFolderName, null, null); + } + + public IPath addTestPackageFragmentRoot(IPath projectPath, String sourceFolderName) throws JavaModelException { + return addPackageFragmentRoot(projectPath, sourceFolderName, null, null, "bin-" + sourceFolderName, true); //$NON-NLS-1$ + } + + /** Adds a package fragment root to the workspace. If + * a package fragment root with the same name already + * exists, it is not replaced. A workspace must be open. + * Returns the path of the added package fragment root. + */ + public IPath addPackageFragmentRoot(IPath projectPath, String sourceFolderName, IPath[] exclusionPatterns, String specificOutputLocation) throws JavaModelException { + return addPackageFragmentRoot(projectPath, sourceFolderName, null, exclusionPatterns, specificOutputLocation); + } + + public IPath addPackageFragmentRoot(IPath projectPath, String sourceFolderName, IPath[] inclusionPatterns, IPath[] exclusionPatterns, String specificOutputLocation) throws JavaModelException { + return addPackageFragmentRoot(projectPath, sourceFolderName, inclusionPatterns, exclusionPatterns, specificOutputLocation, false); + } + /** Adds a package fragment root to the workspace. If + * a package fragment root with the same name already + * exists, it is not replaced. A workspace must be open. + * Returns the path of the added package fragment root. + */ + public IPath addPackageFragmentRoot(IPath projectPath, String sourceFolderName, IPath[] inclusionPatterns, IPath[] exclusionPatterns, String specificOutputLocation, boolean isTest) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath path = getPackageFragmentRootPath(projectPath, sourceFolderName); + createFolder(path); + IPath outputPath = null; + if (specificOutputLocation != null) { + outputPath = getPackageFragmentRootPath(projectPath, specificOutputLocation); + createFolder(outputPath); + } + IClasspathEntry entry = JavaCore.newSourceEntry( + path, + inclusionPatterns == null ? new Path[0] : inclusionPatterns, + exclusionPatterns == null ? new Path[0] : exclusionPatterns, + outputPath, + isTest ? new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.TEST, "true")} : ClasspathEntry.NO_EXTRA_ATTRIBUTES); + addEntry(projectPath, entry); + return path; + } + + public void addProject(IProject project){ + this.projects.put(project.getName(), project); + } + + public IPath addProject(String projectName){ + return addProject(projectName, "1.4"); + } + + public IPath addProject(String projectName, String compliance){ + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IProject project = createProject(projectName); + int requiredComplianceFlag = 0; + String compilerVersion = null; + if ("1.5".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_1_5; + compilerVersion = CompilerOptions.VERSION_1_5; + } + else if ("1.6".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_1_6; + compilerVersion = CompilerOptions.VERSION_1_6; + } + else if ("1.7".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_1_7; + compilerVersion = CompilerOptions.VERSION_1_7; + } + else if ("1.8".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_1_8; + compilerVersion = CompilerOptions.VERSION_1_8; + } + else if ("9".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_9; + compilerVersion = CompilerOptions.VERSION_9; + } + else if ("10".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_10; + compilerVersion = CompilerOptions.VERSION_10; + } + else if ("11".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_11; + compilerVersion = CompilerOptions.VERSION_11; + } + else if ("12".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_12; + compilerVersion = CompilerOptions.VERSION_12; + } else if ("13".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_13; + compilerVersion = CompilerOptions.VERSION_13; + } else if ("14".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_14; + compilerVersion = CompilerOptions.VERSION_14; + } else if ("15".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_15; + compilerVersion = CompilerOptions.VERSION_15; + } else if ("16".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_16; + compilerVersion = CompilerOptions.VERSION_16; + } else if ("17".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_17; + compilerVersion = CompilerOptions.VERSION_17; + } else if ("18".equals(compliance)) { + requiredComplianceFlag = AbstractCompilerTest.F_18; + compilerVersion = CompilerOptions.VERSION_18; + } else if (!"1.4".equals(compliance) && !"1.3".equals(compliance)) { + throw new UnsupportedOperationException("Test framework doesn't support compliance level: " + compliance); + } + if (requiredComplianceFlag != 0) { + if (CompilerOptions.versionToJdkLevel(System.getProperty("java.specification.version")) < requiredComplianceFlag) + throw new RuntimeException("This test requires a " + compliance + " JRE"); + IJavaProject javaProject = JavaCore.create(project); + Map options = new HashMap<>(); + options.put(CompilerOptions.OPTION_Compliance, compilerVersion); + options.put(CompilerOptions.OPTION_Source, compilerVersion); + options.put(CompilerOptions.OPTION_TargetPlatform, compilerVersion); + javaProject.setOptions(options); + } + return project.getFullPath(); + } + + public void addRequiredProject(IPath projectPath, IPath requiredProjectPath) throws JavaModelException { + addRequiredProject(projectPath, requiredProjectPath, new IPath[]{}/*include all*/, new IPath[]{}/*exclude none*/, false); + } + public void addRequiredTestProject(IPath projectPath, IPath requiredProjectPath) throws JavaModelException { + checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$ + IAccessRule[] accessRules = ClasspathEntry.getAccessRules(new IPath[]{}, new IPath[]{}); + addEntry(projectPath, JavaCore.newProjectEntry(requiredProjectPath, accessRules, true, new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.TEST, "true")}, false)); + } + public void addRequiredProjectWithoutTestCode(IPath projectPath, IPath requiredProjectPath) throws JavaModelException { + addRequiredProjectWithoutTestCode(projectPath, requiredProjectPath, false); + } + public void addRequiredProjectWithoutTestCode(IPath projectPath, IPath requiredProjectPath, boolean isExported) throws JavaModelException { + checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$ + IAccessRule[] accessRules = ClasspathEntry.getAccessRules(new IPath[]{}, new IPath[]{}); + addEntry(projectPath, JavaCore.newProjectEntry(requiredProjectPath, accessRules, true, new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.WITHOUT_TEST_CODE, "true")}, isExported)); + } + + public void addRequiredTestProjectWithoutTestCode(IPath projectPath, IPath requiredProjectPath) throws JavaModelException { + checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$ + IAccessRule[] accessRules = ClasspathEntry.getAccessRules(new IPath[]{}, new IPath[]{}); + addEntry(projectPath, + JavaCore.newProjectEntry(requiredProjectPath, accessRules, true, + new IClasspathAttribute[] { JavaCore.newClasspathAttribute(IClasspathAttribute.TEST, "true"), + JavaCore.newClasspathAttribute(IClasspathAttribute.WITHOUT_TEST_CODE, "true") }, + false)); + } + + /** Adds a project to the classpath of a project. + */ + public void addRequiredProject(IPath projectPath, IPath requiredProjectPath, IPath[] accessibleFiles, IPath[] nonAccessibleFiles, boolean isExported) throws JavaModelException { + checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$ + IAccessRule[] accessRules = ClasspathEntry.getAccessRules(accessibleFiles, nonAccessibleFiles); + addEntry(projectPath, JavaCore.newProjectEntry(requiredProjectPath, accessRules, true, new IClasspathAttribute[0], isExported)); + } + + public void addRequiredProject(IPath projectPath, IPath requiredProjectPath, IPath rule, int ruleKind) throws JavaModelException { + checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$ + IAccessRule accessRule = JavaCore.newAccessRule(rule, ruleKind); + addEntry(projectPath, JavaCore.newProjectEntry(requiredProjectPath, new IAccessRule[] {accessRule}, true, new IClasspathAttribute[0], false)); + } + + public void addRequiredProject(IPath projectPath, IPath requiredProjectPath, boolean isOptional) throws JavaModelException { + checkAssertion("required project must not be in project", !projectPath.isPrefixOf(requiredProjectPath)); //$NON-NLS-1$ + IClasspathAttribute[] attributes = isOptional ? new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.OPTIONAL, "true")} : new IClasspathAttribute[0]; + addEntry(projectPath, JavaCore.newProjectEntry(requiredProjectPath, null, true, attributes, false)); + } + + public void addExternalFolders(IPath projectPath, String[] folders) throws JavaModelException { + addExternalFolders(projectPath, folders, false); + } + + public void addExternalFolders(IPath projectPath, String[] folders, boolean isExported) throws JavaModelException { + for (int i = 0, max = folders.length; i < max; i++) { + String folder = folders[i]; + checkAssertion("folder name must not end with .zip or .jar", !folder.endsWith(".zip") && !folder.endsWith(".jar")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + addEntry(projectPath, JavaCore.newLibraryEntry(new Path(folder), null, null, isExported)); + } + } + + public void addExternalJars(IPath projectPath, String[] jars) throws JavaModelException { + addExternalJars(projectPath, jars, false); + } + + public void addExternalJar(IPath projectPath, String jar) throws JavaModelException { + addExternalJar(projectPath, jar, false); + } + + /** Adds an external jar to the classpath of a project. + */ + public void addExternalJars(IPath projectPath, String[] jars, boolean isExported) throws JavaModelException { + for (int i = 0, max = jars.length; i < max; i++) { + String jar = jars[i]; + addEntry(projectPath, JavaCore.newLibraryEntry(new Path(jar), null, null, isExported)); + } + } + + /** Adds an external jar to the classpath of a project. + */ + public void addExternalJar(IPath projectPath, String jar, boolean isExported) throws JavaModelException { + addEntry(projectPath, JavaCore.newLibraryEntry(new Path(jar), null, null, isExported)); + } + public void addExternalTestJar(IPath projectPath, String jar, boolean isExported) throws JavaModelException { + addEntry(projectPath, JavaCore.newLibraryEntry( + new Path(jar), + null, + null, + ClasspathEntry.NO_ACCESS_RULES, + new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.TEST, "true")}, + isExported)); + } + +public void addLibrary(IPath projectPath, IPath libraryPath, IPath sourceAttachmentPath, IPath sourceAttachmentRootPath) + throws JavaModelException { + addEntry(projectPath, + JavaCore.newLibraryEntry(libraryPath, sourceAttachmentPath, sourceAttachmentRootPath)); +} + public void addEntry(IPath projectPath, IClasspathEntry entryPath) throws JavaModelException { + IClasspathEntry[] classpath = getRawClasspath(projectPath); + IClasspathEntry[] newClaspath = new IClasspathEntry[classpath.length + 1]; + System.arraycopy(classpath, 0, newClaspath, 0, classpath.length); + newClaspath[classpath.length] = entryPath; + setClasspath(projectPath, newClaspath); + } + + /** Adds a file. + */ + public IPath addFile(IPath root, String fileName, String contents){ + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath filePath = root.append(fileName); + try { + createFile(filePath, contents.getBytes("UTF8")); //$NON-NLS-1$ + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + checkAssertion("e1", false); //$NON-NLS-1$ + } + return filePath; + } + + /** Adds a folder. + */ + public IPath addFolder(IPath root, String folderName){ + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath folderPath = root.append(folderName); + createFolder(folderPath); + return folderPath; + } + + public IPath addInternalJar(IPath projectPath, String zipName, byte[] contents) throws JavaModelException { + return addInternalJar(projectPath, zipName, contents, false); + } + + /** Adds a jar with the given contents to the the workspace. + * If a jar with the same name already exists, it is + * replaced. A workspace must be open. Returns the path of + * the added jar. + */ + public IPath addInternalJar(IPath projectPath, String zipName, byte[] contents, boolean isExported) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath path = projectPath.append(zipName); + + /* remove any existing zip from the java model */ + removeInternalJar(projectPath, zipName); + + createFile(path, contents); + addEntry(projectPath, JavaCore.newLibraryEntry(path, null, null, isExported)); + return path; + } + + private void checkAssertion(String message, boolean b) { + Assert.isTrue(b, message); + } + +public void cleanBuild() { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getWorkspace().build(IncrementalProjectBuilder.CLEAN_BUILD, null); + } catch (CoreException e) { + handle(e); + } +} + +public void cleanBuild(String projectName) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getProject(projectName).build(IncrementalProjectBuilder.CLEAN_BUILD, null); + } catch (CoreException e) { + handle(e); + } +} + + /** Closes the testing environment and frees up any + * resources. Once the testing environment is closed, + * it shouldn't be used any more. + */ + public void close() { + try { + if (this.projects != null) { + Enumeration projectNames = this.projects.keys(); + while (projectNames.hasMoreElements()) { + String projectName = projectNames.nextElement(); + getJavaProject(projectName).getJavaModel().close(); + } + } + closeWorkspace(); + } catch (JavaModelException e) { + e.printStackTrace(); + } catch (RuntimeException e) { + e.printStackTrace(); + } + } + + /** Close a project from the workspace. + */ + public void closeProject(IPath projectPath){ + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getJavaProject(projectPath).getProject().close(null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + private void closeWorkspace() { + this.isOpen = false; + } + + public IFile createFile(IPath path, byte[] contents) { + ByteArrayInputStream is = null; + try { + IFile file = this.workspace.getRoot().getFile(path); + + is = new ByteArrayInputStream(contents); + if (file.exists()) { + file.setContents(is, true, false, null); + } else { + file.create(is, true, null); + } + return file; + } catch (CoreException e) { + handle(e); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // ignore + } + } + } + return null; + } + + public IFolder createFolder(IPath path) { + checkAssertion("root", !path.isRoot()); //$NON-NLS-1$ + + /* don't create folders for projects */ + if (path.segmentCount() <= 1) { + return null; + } + + IFolder folder = this.workspace.getRoot().getFolder(path); + if (!folder.exists()) { + /* create the parent folder if necessary */ + createFolder(path.removeLastSegments(1)); + + try { + folder.create(true, true, null); + } catch (CoreException e) { + handle(e); + } + } + return folder; + } + + private IProject createProject(String projectName) { + final IProject project = this.workspace.getRoot().getProject(projectName); + try { + IWorkspaceRunnable create = new IWorkspaceRunnable() { + public void run(IProgressMonitor monitor) throws CoreException { + project.create(null, null); + project.open(null); + } + }; + this.workspace.run(create, null); + this.projects.put(projectName, project); + addBuilderSpecs(projectName); + } catch (CoreException e) { + handle(e); + } + return project; + } + + /** + * Safely delete the given resource. + */ + void deleteResource(IResource resource) { + int retryCount = 0; // wait 1 minute at most + IStatus status = null; + while (++retryCount <= 6) { + status = Util.delete(resource); + if (status.isOK()) { + return; + } + System.gc(); + } + handleCoreException(new CoreException(status)); + } + + /** Batch builds the workspace. A workspace must be + * open. + */ + public void fullBuild() { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null); + } catch (CoreException e) { + handle(e); + } + } + + /** + * Batch builds a project. A workspace must be open. + */ + public void fullBuild(IPath projectPath) { + fullBuild(projectPath.lastSegment()); + } + + /** + * Batch builds a project. A workspace must be open. + */ + public void fullBuild(String projectName) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getProject(projectName).build(IncrementalProjectBuilder.FULL_BUILD, null); + } catch (CoreException e) { + handle(e); + } + } + + /** + * Returns the expanded class path. + */ + public IClasspathEntry[] getClasspath(IPath projectPath) { + try { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + JavaProject javaProject = (JavaProject) JavaCore.create(getProject(projectPath)); + return javaProject.getExpandedClasspath(); +// IPath[] packageFragmentRootsPath = new IPath[entries.length]; +// for (int i = 0; i < entries.length; ++i) +// packageFragmentRootsPath[i] = entries[i].getPath(); +// return packageFragmentRootsPath; + } catch (JavaModelException e) { + e.printStackTrace(); + checkAssertion("JavaModelException", false); //$NON-NLS-1$ + return null; // not reachable + } + } + + /** + * Returns the raw class path. + */ + public IClasspathEntry[] getRawClasspath(IPath projectPath) { + try { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + JavaProject javaProject = (JavaProject) JavaCore.create(getProject(projectPath)); + return javaProject.getRawClasspath(); + } catch (JavaModelException e) { + e.printStackTrace(); + checkAssertion("JavaModelException", false); //$NON-NLS-1$ + return null; // not reachable + } + } + + /** + * Returns the Java Model element for the project. + */ + public IJavaProject getJavaProject(IPath projectPath) { + IJavaProject javaProject = JavaCore.create(getProject(projectPath)); + Assert.isNotNull(javaProject); + return javaProject; + } + + /** + * Returns the Java Model element for the project. + */ + public IJavaProject getJavaProject(String projectName) { + IJavaProject javaProject = JavaCore.create(getProject(projectName)); + Assert.isNotNull(javaProject); + return javaProject; + } + + /** + * Return output location for a project. + */ + public IPath getOutputLocation(IPath projectPath){ + try { + IJavaProject javaProject = JavaCore.create(getProject(projectPath)); + return javaProject.getOutputLocation(); + } catch(CoreException e){ + // ignore + } + return null; + } + + /** + * Return all problems with workspace. + */ + public Problem[] getProblems(){ + return getProblemsFor(getWorkspaceRootPath()); + } + + /** + * Return all problems with the specified element. + */ + public Problem[] getProblemsFor(IPath path){ + return getProblemsFor(path, null); + } + /** + * Return all problems with the specified element. + */ + public Problem[] getProblemsFor(IPath path, String additionalMarkerType){ + IResource resource; + if(path.equals(getWorkspaceRootPath())){ + resource = getWorkspace().getRoot(); + } else { + IProject p = getProject(path); + if(p != null && path.equals(p.getFullPath())) { + resource = getProject(path.lastSegment()); + } else if(path.getFileExtension() == null) { + resource = getWorkspace().getRoot().getFolder(path); + } else { + resource = getWorkspace().getRoot().getFile(path); + } + } + try { + ArrayList problems = new ArrayList<>(); + IMarker[] markers = resource.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); + for (int i = 0; i < markers.length; i++) + problems.add(new Problem(markers[i])); + + markers = resource.findMarkers(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE); + for (int i = 0; i < markers.length; i++) + problems.add(new Problem(markers[i])); + + markers = resource.findMarkers(IJavaModelMarker.TASK_MARKER, true, IResource.DEPTH_INFINITE); + for (int i = 0; i < markers.length; i++) + problems.add(new Problem(markers[i])); + + if (additionalMarkerType != null) { + markers = resource.findMarkers(additionalMarkerType, true, IResource.DEPTH_INFINITE); + for (int i = 0; i < markers.length; i++) + problems.add(new Problem(markers[i])); + } + + Problem[] result = new Problem[problems.size()]; + problems.toArray(result); + Arrays.sort(result, new Comparator() { + public int compare(Problem o1, Problem o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + return result; + } catch(CoreException e){ + // ignore + } + return new Problem[0]; + } + + + /** + * Return all problems with the specified element. + */ + public IMarker[] getTaskMarkersFor(IPath path){ + IResource resource = null; + if(path.equals(getWorkspaceRootPath())){ + resource = getWorkspace().getRoot(); + } else { + IProject p = getProject(path); + if(p != null && path.equals(p.getFullPath())) { + resource = getProject(path.lastSegment()); + } else if(path.getFileExtension() == null) { + resource = getWorkspace().getRoot().getFolder(path); + } else { + resource = getWorkspace().getRoot().getFile(path); + } + } + try { + if (resource != null) { + final IMarker[] markers = resource.findMarkers(IJavaModelMarker.TASK_MARKER, true, IResource.DEPTH_INFINITE); + if (markers.length > 1) { + Arrays.sort(markers, new Comparator() { + public int compare(IMarker o1, IMarker o2) { + IMarker marker1 = o1; + IMarker marker2 = o2; + try { + final int start1 = ((Integer) marker1.getAttribute(IMarker.CHAR_START)).intValue(); + final int start2 = ((Integer) marker2.getAttribute(IMarker.CHAR_START)).intValue(); + return start1 - start2; + } catch (CoreException e) { + return 0; + } + } + }); + } + return markers; + } + } catch(CoreException e){ + // ignore + } + return new IMarker[0]; + } + + /** Return the path of the package + * with the given name. A workspace must be open, and + * the package must exist. + */ + public IPath getPackagePath(IPath root, String packageName) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + if (packageName.length() == 0) { + return root; + } + return root.append(packageName.replace('.', IPath.SEPARATOR)); + } + + /** Return the path of the package fragment root + * with the given name. A workspace must be open, and + * the package fragment root must exist. + */ + public IPath getPackageFragmentRootPath(IPath projectPath, String name) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + if (name.length() == 0) { + return projectPath; + } + return projectPath.append(name); + } + + /** + * Returns the core project. + */ + public IProject getProject(String projectName) { + return this.projects.get(projectName); + } + + /** + * Returns the core project. + */ + public IProject getProject(IPath projectPath) { + return this.projects.get(projectPath.lastSegment()); + } + + private File tmpDirectory; + File getTmpDirectory() { + if (this.tmpDirectory == null) { + this.tmpDirectory = new File(System.getProperty("java.io.tmpdir") + + File.separator + "org.eclipse.jdt.core.builder.tests.tmp"); + if (this.tmpDirectory.exists() && !this.tmpDirectory.isDirectory()) { + Util.delete(this.tmpDirectory); + } + this.tmpDirectory.mkdir(); + } + return this.tmpDirectory; + } + void deleteTmpDirectory() { + if (this.tmpDirectory != null) { + Util.delete(this.tmpDirectory); + this.tmpDirectory = null; + } + } + + /** + * Returns the workspace. + */ + public IWorkspace getWorkspace() { + return this.workspace; + } + + /** + * Returns the path of workspace root. + */ + public IPath getWorkspaceRootPath(){ + return getWorkspace().getRoot().getLocation(); + } + + private IPath getJarRootPath(IPath projectPath) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + return getProject(projectPath).getFullPath(); + } + + protected void handle(Exception e) { + if (e instanceof CoreException) { + handleCoreException((CoreException) e); + } else { + e.printStackTrace(); + Assert.isTrue(false); + } + } + + /** + * Handles a core exception thrown during a testing environment operation + */ + protected void handleCoreException(CoreException e) { + e.printStackTrace(); + IStatus status = e.getStatus(); + String message = e.getMessage(); + if (status.isMultiStatus()) { + MultiStatus multiStatus = (MultiStatus) status; + IStatus[] children = multiStatus.getChildren(); + StringBuilder buffer = new StringBuilder(); + for (int i = 0, max = children.length; i < max; i++) { + IStatus child = children[i]; + if (child != null) { + buffer.append(child.getMessage()); + buffer.append(System.getProperty("line.separator"));//$NON-NLS-1$ + Throwable childException = child.getException(); + if (childException != null) { + childException.printStackTrace(); + } + } + } + message = buffer.toString(); + } + Assert.isTrue( + false, + "Core exception in testing environment: " + message); //$NON-NLS-1$ + } + + /** Incrementally builds the workspace. A workspace must be + * open. + */ + public void incrementalBuild() { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getWorkspace().build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null); + } catch (CoreException e) { + handle(e); + } + } + + /** Incrementally builds a project. A workspace must be + * open. + */ + public void incrementalBuild(IPath projectPath) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getProject(projectPath).build(IncrementalProjectBuilder.INCREMENTAL_BUILD, null); + } catch (CoreException e) { + handle(e); + } catch(Throwable e) { + e.printStackTrace(); + } + } + + public boolean isAutoBuilding() { + IWorkspace w = getWorkspace(); + IWorkspaceDescription d = w.getDescription(); + return d.isAutoBuilding(); + } + + /** Open an empty workspace. + */ + public void openEmptyWorkspace() { + close(); + openWorkspace(); + this.projects = new Hashtable<>(10); + setup(); + } + + /** Close a project from the workspace. + */ + public void openProject(IPath projectPath){ + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getJavaProject(projectPath).getProject().open(null); + } catch (CoreException e) { + e.printStackTrace(); + } + } + + private void openWorkspace() { + try { + closeWorkspace(); + + this.workspace = ResourcesPlugin.getWorkspace(); + + // turn off auto-build -- the tests determine when builds occur + IWorkspaceDescription description = this.workspace.getDescription(); + description.setAutoBuilding(false); + this.workspace.setDescription(description); + } catch (Exception e) { + handle(e); + } + } + + /** Renames a compilation unit int the given package in the workspace. + * A workspace must be open. + */ + public void renameCU(IPath packagePath, String cuName, String newName) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IFolder packageFolder = this.workspace.getRoot().getFolder(packagePath); + try { + packageFolder.getFile(cuName).move(packageFolder.getFile(newName).getFullPath(), true, null); + } catch (CoreException e) { + handle(e); + } + } + + /** Removes a binary class from the given package in + * the workspace. A workspace must be open, and the + * given class name must not end with ".class". + */ + public void removeBinaryClass(IPath packagePath, String className) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + className += ".class"; //$NON-NLS-1$ + IFolder packageFolder = this.workspace.getRoot().getFolder(packagePath); + deleteResource(packageFolder.getFile(className)); + } + + /** Removes a class from the given package in the workspace. + * A workspace must be open, and the given class name must + * not end with ".java". + */ + public void removeClass(IPath packagePath, String className) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + className += ".java"; //$NON-NLS-1$ + IFolder packageFolder = this.workspace.getRoot().getFolder(packagePath); + deleteResource(packageFolder.getFile(className)); + } + + /** Removes a package from the given package fragment root + * in the workspace. A workspace must be open. + */ + public void removePackage(IPath packageFragmentRootPath, String packageName) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IPath path = + packageFragmentRootPath.append(packageName.replace('.', IPath.SEPARATOR)); + IFolder folder = this.workspace.getRoot().getFolder(path); + deleteResource(folder); + } + + /** Removes the given package fragment root from the + * the workspace. A workspace must be open. + */ + public void removePackageFragmentRoot(IPath projectPath, String packageFragmentRootName) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + if (packageFragmentRootName.length() > 0) { + IFolder folder = getProject(projectPath).getFolder(packageFragmentRootName); + if (folder.exists()) { + deleteResource(folder); + } + } + IPath rootPath = getPackageFragmentRootPath(projectPath, packageFragmentRootName); + removeEntry(projectPath, rootPath); + } + + /** Remove a project from the workspace. + */ + public void removeProject(IPath projectPath){ + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + try { + getJavaProject(projectPath).close(); + } catch (JavaModelException e) { + e.printStackTrace(); + } + IProject project = getProject(projectPath); + deleteResource(project); + + } + + /** Remove a required project from the classpath + */ + public void removeRequiredProject(IPath projectPath, IPath requiredProject) throws JavaModelException { + removeEntry(projectPath, requiredProject); + } + + /** Remove all elements in the workspace. + */ + public void resetWorkspace(){ + if (this.projects != null) { + Enumeration projectNames = this.projects.keys(); + while (projectNames.hasMoreElements()) { + String projectName = projectNames.nextElement(); + removeProject(getProject(projectName).getFullPath()); + } + } + } + + /** Removes the given internal jar from the workspace. + * A workspace must be open. + */ + public void removeInternalJar(IPath projectPath, String zipName) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + checkAssertion("zipName must end with .zip or .jar", zipName.endsWith(".zip") || zipName.endsWith(".jar")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + /* remove zip from the java model (it caches open zip files) */ + IPath zipPath = getJarRootPath(projectPath).append(zipName); + try { + getJavaProject(projectPath) + .getPackageFragmentRoot(getWorkspace().getRoot().getFile(zipPath)) + .close(); + } catch (JavaModelException e) { + e.printStackTrace(); + } + removePackageFragmentRoot(projectPath, zipName); + + IFile file = getProject(projectPath).getFile(zipName); + deleteResource(file); + } + + /** + * Remove an external jar from the classpath. + */ + public void removeExternalJar(IPath projectPath, IPath jarPath) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + removeEntry(projectPath, jarPath); + } + + private void removeEntry(IPath projectPath, IPath entryPath) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IClasspathEntry[] oldEntries = getRawClasspath(projectPath); + for (int i = 0; i < oldEntries.length; ++i) { + if (oldEntries[i].getPath().equals(entryPath)) { + IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length - 1]; + System.arraycopy(oldEntries, 0, newEntries, 0, i); + System.arraycopy(oldEntries, i + 1, newEntries, i, oldEntries.length - i - 1); + setClasspath(projectPath, newEntries); + } + } + } + + public void changePackageFragmentRootTestAttribute(IPath projectPath, IPath entryPath, boolean isTest) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IClasspathEntry[] oldEntries = getRawClasspath(projectPath); + for (int i = 0; i < oldEntries.length; ++i) { + final IClasspathEntry oldEntry = oldEntries[i]; + if (oldEntry.getPath().equals(entryPath)) { + IClasspathEntry[] newEntries = oldEntries.clone(); + IClasspathAttribute[] classpathAttributes = Arrays.stream(oldEntry.getExtraAttributes()) + .filter(e -> !e.getName().equals(IClasspathAttribute.TEST)).toArray(IClasspathAttribute[]::new); + if(isTest) { + int length=classpathAttributes.length; + System.arraycopy(classpathAttributes, 0, classpathAttributes = new IClasspathAttribute[length + 1], 0, length); + classpathAttributes[length] = JavaCore.newClasspathAttribute(IClasspathAttribute.TEST, "true"); + } + IClasspathEntry entry = JavaCore.newSourceEntry( + entryPath, + oldEntry.getInclusionPatterns(), + oldEntry.getExclusionPatterns(), + oldEntry.getOutputLocation(), + classpathAttributes); + newEntries[i] = entry; + setClasspath(projectPath, newEntries); + return; + } + } + } + + /** Remove a file + */ + public void removeFile(IPath filePath) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + deleteResource(this.workspace.getRoot().getFile(filePath)); + } + + /** Remove a folder + */ + public void removeFolder(IPath folderPath) { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IFolder folder = this.workspace.getRoot().getFolder(folderPath); + deleteResource(folder); + } + + /** Sets the classpath to the given package fragment + * roots. The builder searches the classpath to + * find the java files it needs during a build. + */ +// public void setClasspath(IPath projectPath, IPath[] packageFragmentRootsPath) { +// try { +// checkAssertion("a workspace must be open", fIsOpen); //$NON-NLS-1$ +// IJavaProject javaProject = JavaCore.create(getProject(projectPath)); +// IClasspathEntry[] entries = +// new IClasspathEntry[packageFragmentRootsPath.length]; +// for (int i = 0; i < packageFragmentRootsPath.length; ++i) { +// IPath path = packageFragmentRootsPath[i]; +// if ("jar".equals(path.getFileExtension()) //$NON-NLS-1$ +// || "zip".equals(path.getFileExtension())) { //$NON-NLS-1$ +// entries[i] = JavaCore.newLibraryEntry(path, null, null, isExported); +// } else if (projectPath.isPrefixOf(packageFragmentRootsPath[i])) { +// entries[i] = JavaCore.newSourceEntry(path, IPath[] exclusionPatterns, IPath specificOutputLocation) +// } else { +// entries[i] = JavaCore.newProjectEntry(path, isExported); +// } +// } +// javaProject.setRawClasspath(entries, null); +// } catch (JavaModelException e) { +// e.printStackTrace(); +// checkAssertion("JavaModelException", false); //$NON-NLS-1$ +// } +// } + + public void setAutoBuilding(boolean value) { + try { + IWorkspace w = getWorkspace(); + IWorkspaceDescription d = w.getDescription(); + d.setAutoBuilding(value); + w.setDescription(d); + } catch (CoreException e) { + e.printStackTrace(); + checkAssertion("CoreException", false); //$NON-NLS-1$ + } + } + + public void setBuildOrder(String[] projects) { + try { + IWorkspace w = getWorkspace(); + IWorkspaceDescription d = w.getDescription(); + d.setBuildOrder(projects); + w.setDescription(d); + } catch (CoreException e) { + e.printStackTrace(); + checkAssertion("CoreException", false); //$NON-NLS-1$ + } + } + + public void setClasspath(IPath projectPath, IClasspathEntry[] entries) throws JavaModelException { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IJavaProject javaProject = JavaCore.create(getProject(projectPath)); + javaProject.setRawClasspath(entries, null); + } + + public IPath setExternalOutputFolder(IPath projectPath, String name, IPath externalOutputLocation){ + IPath result = null; + try { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IProject p = getProject(projectPath); + IFolder f = p.getFolder(name); + f.createLink(externalOutputLocation, IResource.ALLOW_MISSING_LOCAL, null); + + result = f.getFullPath(); + IJavaProject javaProject = JavaCore.create(p); + javaProject.setOutputLocation(result, null); + } catch (CoreException e) { + e.printStackTrace(); + checkAssertion("CoreException", false); //$NON-NLS-1$ + } + return result; + } + + public IPath setOutputFolder(IPath projectPath, String outputFolder){ + IPath outputPath = null; + try { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + IJavaProject javaProject = JavaCore.create(getProject(projectPath)); + outputPath = projectPath.append(outputFolder); + javaProject.setOutputLocation(outputPath, null); + } catch (JavaModelException e) { + e.printStackTrace(); + checkAssertion("JavaModelException", false); //$NON-NLS-1$ + } + return outputPath; + } + + private void setup() { + this.isOpen = true; + } + + /** + * Wait for autobuild notification to occur + */ + public void waitForAutoBuild() { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + boolean wasInterrupted = false; + do { + try { + Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); + boolean enableIndex = true; + JavaModelManager.getIndexManager().waitForIndex(enableIndex, null); + wasInterrupted = false; + } catch (OperationCanceledException e) { + handle(e); + } catch (InterruptedException e) { + wasInterrupted = true; + } + } while (wasInterrupted); + } + + public void waitForManualRefresh() { + checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$ + boolean wasInterrupted = false; + do { + try { + Job.getJobManager().join(ResourcesPlugin.FAMILY_MANUAL_REFRESH, null); + boolean enableIndex = true; + JavaModelManager.getIndexManager().waitForIndex(enableIndex, null); + wasInterrupted = false; + } catch (OperationCanceledException e) { + handle(e); + } catch (InterruptedException e) { + wasInterrupted = true; + } + } while (wasInterrupted); + } + +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/test.xml b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/test.xml new file mode 100644 index 0000000000..87d41e0907 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/test.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/workspace/Test571363.jar b/jdt-patch/e425/org.eclipse.jdt.core.tests.builder/workspace/Test571363.jar new file mode 100644 index 0000000000000000000000000000000000000000..fccdbfee9fadb8e216574342f87f349adad113be GIT binary patch literal 1250 zcmWIWW@Zs#;Nak3NNkD>Vn70%3@i-3t|5-Po_=on|4uP5Ff#;rvvYt{FhP|C;M6Pv zQ~}rQ>*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5~>Z zypnt&sg?0VTvhG)5-p48;-XK)Ri`nCW`8RBSi}f+!=GJyW;p?E0AY|DxEL6K?wZ?( z>H!v@Y<^L?K0?J}G!-DvfK-$lCnKp^ji!nRNmWXIE|N+Xv>+2gQ<d-$C5^YIToq3?BF+uZM(_sR2Dz0aLE zuXz)=uD9_WcRKAf+o8Nq^x&M8K69V5)Ed|bWOdt2Vkuv1v~%Z@MxAeU6E-Bj|Ku%r zYN=N1%U=I~SIZL)DV2Oy65H;nvB*aBVW8^74;*ugoK)(>x^oLAJ(R4?_``UhJ+S%X z`U=*~=T?Ph9+0qg>|b>^Vb;`@#<}ODX4!+1=)wYDhAlvkT>^WZkx7IBHHE{HFDQkh z0(g=IrS|}DRISLV4wSwTz!u1aYeh=!AQQM4aHmd$2?v2pNLoecz?NDOIvzuHK+-Nk z7q--k(8bA!Nb!)gjL?amHbAKv0gTaf!qPS(j6kUyIn{wuHv%MM)elMQ$RQ1K1#$#} dQYZpE#bF9Ky#{!*vVoLx0O1>;!Uy1p1^_F7BCG%a literal 0 HcmV?d00001 diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.classpath b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.classpath new file mode 100644 index 0000000000..73d6894a61 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.gitignore b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.gitignore new file mode 100644 index 0000000000..e7af312dd6 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.gitignore @@ -0,0 +1,4 @@ +/bin +/endorsed +/target +/test.dat diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.project b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.project new file mode 100644 index 0000000000..bce5dfc9c9 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.project @@ -0,0 +1,26 @@ + + + org.eclipse.jdt.core.tests.compiler + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.resources.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000000..99f26c0203 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.runtime.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.runtime.prefs new file mode 100644 index 0000000000..5a0ad22d2a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\n diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..239da5461a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,128 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.builder.invalidClasspath=abort +org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch,.svn/ +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +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.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=ignore +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=warning +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=warning +org.eclipse.jdt.core.compiler.problem.unsafeTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=error +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.incompleteClasspath=error diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000000..cc05ab3605 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +#Thu Nov 04 13:38:45 EDT 2010 +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=false +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=false +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.update_ibm_copyright_to_current_year=true +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..518b1ce98e --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF @@ -0,0 +1,30 @@ +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-Vendor: %providerName +Bundle-Localization: plugin +Export-Package: org.eclipse.jdt.core.tests.compiler, + org.eclipse.jdt.core.tests.compiler.map, + org.eclipse.jdt.core.tests.compiler.parser, + org.eclipse.jdt.core.tests.compiler.regression, + org.eclipse.jdt.core.tests.dom, + org.eclipse.jdt.core.tests.eval, + org.eclipse.jdt.core.tests.eval.target, + org.eclipse.jdt.core.tests.junit.extension, + org.eclipse.jdt.core.tests.runtime, + org.eclipse.jdt.core.tests.util +Require-Bundle: org.junit;bundle-version="3.8.1", + org.eclipse.jdt.debug;bundle-version="[3.2.0,4.0.0)", + org.eclipse.jdt.core;bundle-version="[3.10.0,4.0.0)", + org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)", + org.eclipse.test.performance;bundle-version="[3.10.0,4.0.0)", + org.eclipse.core.resources;bundle-version="[3.2.0,4.0.0)", + org.eclipse.jdt.annotation;bundle-version="[1.1.0,2.0.0)";resolution:=optional, + org.eclipse.jdt.annotation;bundle-version="[2.0.0,3.0.0)";resolution:=optional +Bundle-RequiredExecutionEnvironment: JavaSE-11 +Eclipse-BundleShape: dir +Bundle-Activator: org.eclipse.jdt.core.tests.compiler.Activator +Bundle-ActivationPolicy: lazy +Automatic-Module-Name: org.eclipse.jdt.core.tests.compiler diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/eclipse.inf b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/eclipse.inf new file mode 100644 index 0000000000..4ea66d6f8d --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +jarprocessor.exclude.pack=true + +jarprocessor.exclude.children=true \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/about.html b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/about.html new file mode 100644 index 0000000000..164f781a8f --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/about.html @@ -0,0 +1,36 @@ + + + + +About + + +

About This Content

+ +

November 30, 2017

+

License

+ +

+ The Eclipse Foundation makes available all content in this plug-in + ("Content"). Unless otherwise indicated below, the Content + is provided to you under the terms and conditions of the Eclipse + Public License Version 2.0 ("EPL"). A copy of the EPL is + available at http://www.eclipse.org/legal/epl-2.0. + For purposes of the EPL, "Program" will mean the Content. +

+ +

+ If you did not receive this Content directly from the Eclipse + Foundation, the Content is being redistributed by another party + ("Redistributor") and different terms and conditions may + apply to your use of any object code in the Content. Check the + Redistributor's license that was provided with the Content. If no such + license exists, contact the Redistributor. Unless otherwise indicated + below, the terms and conditions of the EPL still apply to any source + code in the Content and such source code may be obtained at http://www.eclipse.org. +

+ + + \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/build.properties b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/build.properties new file mode 100644 index 0000000000..cfa629f680 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/build.properties @@ -0,0 +1,23 @@ +############################################################################### +# Copyright (c) 2000, 2013 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 +# Red Hat Inc. (mistria) - Avoid nested jars +############################################################################### +bin.includes = test.xml,\ + about.html,\ + .,\ + META-INF/,\ + plugin.properties,\ + workspace/ +source.. = src/ +output.. = bin/ +src.includes = about.html diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt new file mode 100644 index 0000000000..c997cd7c6c --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/forceQualifierUpdate.txt @@ -0,0 +1,2 @@ +# To force a version qualifier update, add the bug here +Bug 534597 - Unanticipated comparator errors in I20180511-2000 \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/plugin.properties b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/plugin.properties new file mode 100644 index 0000000000..923f64d0db --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/plugin.properties @@ -0,0 +1,15 @@ +############################################################################### +# Copyright (c) 2000, 2006 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 +############################################################################### +providerName=Eclipse.org +pluginName=Java Compiler Tests diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/pom.xml b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/pom.xml new file mode 100644 index 0000000000..48003936f2 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/pom.xml @@ -0,0 +1,48 @@ + + + + 4.0.0 + + eclipse.jdt.core + tests-pom + 4.25.0-SNAPSHOT + ../tests-pom/ + + org.eclipse.jdt + org.eclipse.jdt.core.tests.compiler + 3.12.2000-SNAPSHOT + eclipse-plugin + + + true + + + + + + maven-clean-plugin + 2.5 + + + + ${basedir} + + test.dat + + + + + + + + diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/EvalTestsTarget.zip new file mode 100644 index 0000000000000000000000000000000000000000..d42def46ad6b8e2810716da388e1fb9454efee8b GIT binary patch literal 13598 zcmcJ$1#Dc+wk7PuF*CCrbIf*|nVF%@%*^cAj+vR6nVFfHnVFemntb!_|L%A1XrAWH z=-;iDs?}9zmAd-uy>#|ka+09mP(dIeAwf{$RTV(~7EmDHK%|A0_-VvtMCd+7K|nx3 z=|C;gjAJgRiw~JB#%=pj6()=>wBEpJFw9+DX(&J-Nk~Fk4aFR5XljBo$3iR`g z+Xwcv64KP-(lbt_-=IN+@551<-olXM92C&f@4}#O!;mF^g)+OfxVHSy9gwVpP_pjR*{PV4iy$PL>fu)(PgAtv%p(CAvjlB__qmhH71D%nxo+X{5p1p~Y zBb}g)p^>7snXRpnqoAdpgM*Zfo}rOFt-)X80-%K=iVCI|%Stt(N{b&qVtuRtWPa|$ z*I*jf0kR(GT>S;w5khc5mJMo|2ZK+rchL7)gqoyfGZV|#0-0Bw-zA^9jH@ROGK)fj zt0z)@)gJbnYj<2%9x`69XRjt8lSC%nMLWJ1hWbPaW9XqojTz1c6l+KfDySR!Qe5@+ z3`_Qa-iV1cvzpW?bm-oUDYXIp^~Tv=hHQ)D%|?9nn)HOJer-lGQw>#3o$xA6X=<{i zOHyTYbY@c=Z1}@`?g~xem>oN`t}|nYnla^@P7ABU{`$Z}tlUwP4K=urm>DOy*8b_Q z#`H*hae<4jEOfDLoN2vkas1dEyUwGd6&f;WWi9m6q0F@fN!@>Di4~2;ZGBS9BPI=|y1M zr9;l7$V8B4Y=7K=^TXx5t8rZdROb8HB2DQVEy>L;AXh?@LtOT?B`XVqGmGS%?Xqb7 z+wYEnHJjc)21Zn!D(3zCf!FE;*57YLh&!<-Q;z$PT2cWF5sX5O2Hc4FfIcK)&ZlS! z<`06Zsp=}Qeq^zO@}a1e-{3UNq$dXz`G{OlwTJB?VAsFy(Oh7_*6hNPtW@CVnB|An zC~AmrD>=Y%W?y1M#uQo?D=c~NsxrvT+K7y}QG{^CL80J8Ee7HmZ`Bbs(8?nXILVX| z4GX^(*d@4Hz@LFJ{31aUqp&Zf5WMl8VxmEqN)0*NmVa>IIi0T>-@*aCw8CmG>2dLp z>D{8Y!yzzZi$*7Tl6ap1w`%8ZYF}@TbCF)}8$w+RTxvgx@a|L%?{yUcG@38rCheO6c%{xD>#Xv7*Q}^<)bO zZAv$7J^kd*MfR%uCL{UlYNSf{GKaT!)kJb+Sk)WrsOUcW1J~z%?)_`e^#T6Y-|7k8>YAU3xChM-}lIevO|xMS{Vl;gjP%NN@M?mm>*enLjP=*la+Dl0+th`aLh4Bfu^a0>V1hqwrT?)A$`Cbl8T^!a|t=F<^M#JtK(nANPP)5e_pxT>Wd2*4`{wa@hyKh(Yt{Xwb+>ar8Ua<( zO)mUNVjl5GBBe<0+($Xhp*OfCL}2@_0|3JI=Y;(B1mnw`FD|$K1H_`vvE6f6@lD;? zXMHd_4W+Bj_oiwsL%8#8gPznT7>g=CrjM_G9k-BGm4?q35RidC?Bai4*8iW58}J{; zU7>v9FsF?8X_YP%No;Qi4h=;(t+|~T|5ZF27ixPE3N=j*x&Rm-l$R|g5(|3&EA!;b zH+O-nlOkAxlV5tPCpRH7FW_6-pT~|I85A2PLy>qvIdLW2vC3_)&Rdrs&RN#)cYRYJ zi+jGlL;^t<{k{UM5zSP-eSX?eKV(s`MQDkXF%hr*K%-dj^)ATpD{B{`QHit!897WLyU(Pu0VC*bTGdsz>F*NTJbDSjHCV$PtcDR&u@`Iq;rqg}ZAQW?P3jyZicwC7xAMjt>O1s8@*f@JoCgPlQL z)TvhL6LUa*QBn0fnLtuzMl<|LmJKl-FagbibXu72=}eM?P@uT#Ab?>vRZW8?D?Y3; z*pjK;KX;!eALI#94a8m+Db4~Q0;G}V#w%KBHCZikU^kX?vdOC&W8x~wMU>9_X=QRU zwkxJ&ZRV@}JZ3vxOT+1ZWRg**!R=~`3GLMalDFJOwZsm*;H2d;9_70RBlsb#JP-Xr zyQ@rTiARI$X}iL;wO3YQ^e8QnbMMRmydaqqe@{!TNaZ%gjKN9a#ck-gE>D;P7k3LJ zyJTU5;p9nKV15m%HdxT^)!s|fm^1hM9sBuSRZ?y#r5iOUkoi_F5w~*`QP+)K5$8qg z6xdj=?YBDX42MRuB=1C8z?O7XP!5UR$5jXv&qKbe`IQyUFrPnx`tGC8g0Q+|k9G>A zE>$~xg>n+7wWM;Od^R#dj=Ie1{@4s3JQa`VTwurU%B{>}%R@?^KmJidGct4XLz;?9 zTSHSLwZFAd=ffoq1rwo(Y=+&3;bk4*qquWb^DgQSKhNcWmx39)94EvSaumy!jMNp6 zu0p~PO*L5?d2h@Fw`lna_mP^1BDZRvuyQc`ZM5Lb6**6(*|*#NV{A+MZPFy>=jI`? zFwfO({tkJ7Tkx}ja9y>3m>u|nBl_4eF19J|g(Lok9%h?R3$7HloBO+U zL8N^1upMlX=@_|IYrv}L5BgLSPel-`^eOxf^%GBzUM;9;dJd>b<$M&wR~6QW6`E9^ zn6ypCTomSUq&EB}=F`5b`v6_TmN4Y$KyR5gjZZk+vwn;+fen3%?8^$FI$kJMC(xbo z!1opXN>*~+#Gqiy|L&Oel-&1F&;mVp=@30m>c%;k_25dk@Z)L^)C>JibP_9^k+dx= z`XfWuZ2kl0uM$yCTZ`H7hY`rY{{L1Y82`Ztl+F}T)DS<^zkC zd`zil2j&MJ6xOYv?F}1Or)QfiK9R2ao3axG_;IZqTnYRQ!V_1atF+d8|l#K}+yKg2zA|P}V_W7A-*QO4^7Y7BU0QpWde7^44665M^u}|I1H6U6cQtNv@O?_UU5Kb!%<}o4c{v*PP)0^BlGmElt`*|g}@AQ>WCQf;C zP1PjlXuPisrcKMPWlT;{oi%2FEK9D4f*i(0N$@l}tAN*Gph~MPWDwk&Q1kq00ea;2 z50kqx*qz?biVph+$quJN0b21Tk7is4cp(2|Fa7Pey22c32y5v$M-?nl>bFn_e|(n7 zkRf|Y+c+WHrd5Z&r%UP7af6;-8@4Ih2ewHX{ADHvnwfKbLD)n}` zq~^~t7xYp8P8;>UjFe1yZ7N+R%I?v0gdrs4Ldcmj$OoKl15*|J;4(z0HQi zJ+@G3O<JZ%2xn0&L!tdKn0#*@H`Ts+zvW~ZdJ{Pp)p!h0zH`FZ zaq@!8aAH z=OzbHI1}W>Ckb%_dX|jScw!j8qcm#4-38_V!)v{_OopCOx5m~If>mINJ;_AcxSED( z=ZsnWZ?_jsW^2dsr}g6V2K!ZO}HxD*K531kAfb zJ2y+);8&wuHY?^qdfYuantKq|Z-}N7?#sH3A_Qy)e2M^L2nU3$Lc5Hb$XhpTR@KxQ z1!2kU6gT?y5umwhSl; zh%@+qb?@^0Kd||KkUMoKU8RME4;f>(xDimn?=e2V z#=^og+8OueHj9=yRW(32K+{GvSZ9-1<|_28E-scfR9ICw*LbsPteG$5zI5Gfl1QP? zZ+ xomkJZF*d`9Q{1vl$(V_moBiYN(g*`!1T!hvL}6)T%%%fsYaOm@2Nc1IsGp6rxis z8*!odgJVUpSN8Rd-tBNa1QhB`}d(jdW7|ktI=EsvcHKG+gT~}5Oxp1v=pR-3* znPOl?;==r5l*fXodxR>rQ`I}-%aQ`~#HsM%L?oOp6ihB=>l?sCX;hW!^e@i?OeWHd z=nngIeW*6E(Zadn%&C*L+KSzGLIa%cOrFqj1mM`#zEaI#i_@-8>qFhnfm3J7cN9+r z>-qL@6I&LvC^Y+Y75&t%15TuB6=;~l22!VfCr5=ML%#DHIaJ$WLm)=q`aZ0I7Dfu; zz7x^!3+FCTZVoIU0QeqN?LGB8@U@Bd zGzexW6*FMZG`IIAjFAx2LZ9Ro4wsJY1SWYb%I?QJ#gIcpFQv&O6q$WYQ3W!JXkSqU z0Htq-(Kc6i)!T@imuy!xOL%q_Fep!1`YaWw{8P^s*sm}Y8Q>c;(BrC_rI>MP z=#UKl(A2*xE~@?==-9MsNblIQt{X;UqHA7d>nJsBTOZX))*Q%qfVMb=yR|j$b?O)x zf|WcnpiVxai|Gne_CvkE#yBPUqMhANM1gaX$qv1_vx#}dH5K|5x=g9Hb2f^CP1H)A z<{EWTB~s^H6z&iwd5D;|{XE>2t2u{qRktE*DK&kGjd2m%N^D%4pjJJ0M|Hlx#eH0~ zL9QvkV<5mT6T{;?W4so7A>_x8;o>6gk7hK>1#Y>37_saRceKikQG*@jwvLm zV^wSZ-uoiM>XIow4c5tWobycfyw2ELrM%+bcbA5tKI)*7j`pX?_3mFLntQ#z#CkEo zr`iXCTenAL6A&_`nhG#R#ecAb(PD*bz_EY~YB0BBp#(f+weqc-hua3!*7H01F9c&Y z^U{98zla!Phl2w5E-p+m?K7~)palqK7Dy8hvJuCPV@LkPhR>hQ0 zP~P+$M8H#8s3!J{=56p`&RfkwmLB?Oc4^x z@v(fV9>eXrh3`&rL>ee5c|coLS~JYncC%qQN8@Cu3OGu5fL;J-cR9k7?FF(lD)a$| zds&Ew9Rb2XYc(_G&dEMH{C2J+niB#2jr4$US43DCat~QyHN;J{j}4OUtSpTgvl{G- z&7PisgCu=sbtx*ihxA5A5G4UVX?a31AS!J+@B&*%%3!2F*0%NqGB5G>H3?EDNjzl3 z^YjjrN<(ofC)$UoMdF%OFKE@{1@ldO>17Q$%QaKT4#q)%f$Y5jLF9u0Zzkh)hBk$b zUR~i=6bResKr-_wXmtywZ|eb)5A}}*RRna~ui%|aoIq)5gbO;!X3cVtY;gKnYDF_JTD|!@E}XDB zPB}CI14NkB+mGbcCTG)~6d5{QG&7x?%SzwC%h`foHwW!|!@f%H4&N$-N@P_RWW-n? z;=o9R!Dduzv-#Qc7P=2$e8HSgX=ykrvjgU10}nyaYn@np9~6wq-pir{xC`b#`3bXJ z#UtJCUmUfL(`asz4`(Gzm@YJ%>od<&A&GZc8Q|ui7WGpBVydawc4egcb9?Q*qoZF& z-i1b3jDq*+X-JDJfGbHN1l)*;`O3J)5|!{1+C$W*uo)N`Xfm3*!!sL~GpVqmxRjcB zG9>S@MbBLFBFO-So#}awy3(4#TI_Og5#MltQ9T}%GMBa37qsKHxA8?=f3!H+Wah!x zK~d~;hx}2vNHsjh)!%D_Ph$)KWyL8%D?FP~C;Ya@7GY=z?8%Jv)x5=JZy|+Jv2lbZnCWiC?;Rkw{G z>$Domg{d7X64POcO!v>G!g6FFhk1qUqfrQVi9$aBsh`q{Ic2t7_;lOVqF&{N?Yq2Y zd6u54hTk1SYv%&lbF&k#P+CFnymubZhn&5 zf{n=0t!|O-?G#TV@321p1E=DBjkWB>TkH3)i9hG!o!z1fwaauYkC?q!Djk!&ZxN#k z=AC7-s#zS$g0m>ON}Yd7b!GqTjLPLOPNP_3rZJVK&jP`dHosDRU(u5Y`ufXd0?hCS z)WxdVC~e!Ax-5h&W-WQdDsbYAu$0Fww8ounhhwW^HaJq|v7Tbe(S+n+%WH+k0PaP` zg*2vimuqbr-spbJi#@x|P>&_QnnP=RbIR+bl7bF$3=lQJcs>=xn8C_Re<0lE4lAq= z)%)9eyasZh-$57i_L(QV= zus!<3+0jA)N3aaA0D;>y1=#1BY(aq~yRC|>ivhw5Xpl0tV1s>LP8)Fse+}xB^1$yu z%A3usdr6Ob~shO-ia;+$Rl{5=p2?TXKCgnu6`;hfKm6I@YOUyGdVqFa28Z8kvhSwkqoha&w< z$($*nRcfzwu4VFs4c=t?+jzbdsgX&}dSa7GLH*KV1#XcZz-cz|G)u3^5rS5!nj02N zi(^<c_NjhsMfl~sg!<{w zouC#2H3N8_;*(Hv%>^q=EmJ?fl&q8?lpd<(*AKgyn1_eGs$j)MU_2`Y2CujvwaY=-@|05$}$i4a{Ye# z>3-L8p9R*83u6a|zN1V%s8aLIB^!RLTfvf_`?3%46K3p&UU{3Lwh&J>AOlhl0lOL@ z!WCZH6@TIxztxqQKh0%nq$tKR5CKdJC+^0n55%*gCn(o>vP7!m{10fW>rC z+n#>~SaCx|Q-X5JIOK3_)ig_-S&L;$47z&nFgE3#9sVm9CXJ$5#mKdN0$?@VQ`3Tp zrpU92A+T`gC#L3{q$I7Z@S5Yk^URyJNSY5Cw%vXmn}7Abkr5nzy3_NN=rseqY!DS` zX%}<4&)Y(XBzreI^I}zO3yP*J;ry2{Ruza|hczTc?_f0Uklc%4Mym>xH9^|TB?q&v zOsd}x^$%w+3RRiALoFk)y~eZ?rB5i;Go7-7Mvw2fnr2%`JLa$WeGL?@VaQx)@PK1O zcGvXA6%o0ONIO^GI<61_4s8YwSE-D2EAoiuFp>2LN{(IjZ!6|p!a6S&kJK-)=9{Bcw&wwwQ#eHba_^j8NL4@fSBB!dR zP1dzhvKp*)K&vKeJ&Tr&)`SZ5wugjy28^ELT!!>I7_9Syjss0l95=1OGYM^#yH;n& zrH+W6Ba#SlL>vxJ^G*2mkLnEHc^U1tPtnGYLgKhtUKAI7Md(uU8qtl`deg1>n9K@H zh5gidp9yvs7u_*qOisJcMxv+u4AZPZ_p06u`OBMlkF}c6Vn9hRBqn>5<93boH)cUm z?jHFx`t}K`md%(aBFO^tRl8i7J+bp@Qs`FFKRJeIM;C460l?essBL}G>Vc3?+eNZ{ zDRhLgoNzX>{MCWe*-2NHlXlI|Q_6En$rV)F1tJs9mGk;-SX0)oEoXh0IkPt&T1UQe zr~|O=a9~fcbpZNw(-%6c*d`^|Thzug zEq@OI)9F~EpVe#IY^d}dV z=ZGDNt|sx`oBFXe%NB-A?6)59F8!}vz1c}^n&Y0YVl~bv=bvI79a0cfEuSOj9tnsq z7$3ivd1D)gi<D!#BH1aMMr7h7`D>QyoAUWaJA`r@IYUQH^ z`lz&ygf3sJ^(I=>pAow<^7xW>g-I9{!eA{=ouNhavX)`GwX@u|-h!H+Eq%Vlg?0r? zNBxRx+S^Ef;<&cy@J?@aVSmaY+JIAW>FXP8%v8mj$Pk3yHb5Rr+@seVoUS#H7s7Tx z?kHJLoXE(RC%NEE<_-#dnpv^XJP6NC8ECl_N6XCpRU`;t2Gow#N^+8v^?v6{ zcZ{By(CD6C5^Z4Q0@b#Hrx|gA2w!Ds+HVbevbu0LkJ?{w8oh>Yl6+COf+8;JrP_## zUyXC+B*_N3<|?#GdgHd2+K^*!R2)1Gv%>>qzFH(1eAR|y_oFWCEh2n8tEZl({Z1yv zuyxH+Llk#4$Q4!li*9IvklaRq?^Sl>W-VF|9Sl}s*O|*=?TRUbfb(mphk@lu*w>WT zb&Y6(VG>_);mPkF%h@1Jjgp0ix*?O!A^}^#OkqK=w-&WH%JE+-gmuoND`|4MsV94H zAYm*eK(LaB?C$JM_G&zndLwabX|}06G-yhQno%&WE+h7O*3bo$wfr=mh$+IYK_Z?V>eVf04_5b~ZDQ@6A*=^d zC2@Blyw+=Zo8K4xP=~3=`{EU&1u2;XWQ_2p-O@hOi|AOf~aVoi+HeQ;xH@<$!p*Aprm|w?`Ze8 z1otsSBpyZ9%dUodzkP_$UoIgJZA;iWU7tqK5R?4>By*XroM` zm?+3k3^SvwD9xRxTIEHgkWsPnr7>`#MUr$H47)_?*e=E9s0glzgU97Gda=##-0l7b z+_x;Gw4`zLVo(`BFHG&(ndO-bW}XyBOjV;t!mo?oa`{$;kJybUqF*Sj<+~Ox1gjmCgTl{V3$xkz+S!O z!4;n6R>I}b-VVRmG3?vtSd|T)^m+l*iGr`mK5XA>PUb>#7)EL8s4yv6pU0<_k>9JE zR?GZAxcQYy2FYtc7kdONL8E`0?P#t*3wXaQ8S{{*Z@IV*S4X2dW7*#ZVWJlNG^w1& zb$HHSyFrWMGJ|ZTy%5~nZ!^<)e6U<0*O3IC^0fHTX7qG1x*uwanI%k7;jfVC%cfmu zWU1>KZJ~8$H411?LA(8VX8urai!L})LauFKd)yRQ@p2&Yp)DIQ1`VUdF_Qg0@Q$v+piX{;-6#UkIWv1l6V_k_umI)Fe$f;rK_<7$@7;* zDg9o7*?6Nwp^_X2G0;ts(9N9tH!^Oyy?G&*Bc#9ATCl)83|%t%C?6@ybgy_!DrDRq z%}TB>W8QJsD5fYT^e#O+@z}>>H~p?Dz+Sw%UDXL{FM^z(RsBX0m~}SCf4XIPig?`A zpUb=q*yBorwhIzGDEQ>ONY^>WDdE5+#<%-+sb-==36GdkWJimznbyh}dYv_irly45|EWvF} ze|Y6@fler$l-mEcX3fda6M~4%VhEov z(_A*O!I@2L)yZn@vd+Wal1$V5?E0&pA;x62W{3#_f=2gW^)uN2&-)qTLc-$Kjz;#z zdIm=SXhJHh*`TPPevmaXMlvEI)4z7+%Lv%6^de_Re=9B#|HW3Qn=O?t3D5(?O@^z% zY-ES2hg6ojmaOtH(Q)wskxS}5OXels@!pXrMt^ zn1HBKU%LFAZ%U)I3EKuM8)c|Z;Hu`KZQ)Zk_(gu8+D7FbL?Oz)bQ=i~EEJqmyet1C zHVP9*J|V-UJHL&YrJO6O;c>4^*b$f~vvGoVP|j;Yaong@q5+r(laOLcA{W8NWwh9L z-xhFedRak|h1e>C?b??vkQ&|8kew8e6EJJv>|p9hb(>1(UN?v*X}*}jrB_s1#%>Z(BYVGS90`vh)ubTb&b<+ z6uQ^_*~#8*SgS!f1$lv#_!138peBymxWHrdue zYa@M%dB=fEkT8l+{B;1MV|luagOg&h5J#QtBr(ODU8uh@=p_|cRKjVv&ysE8bc%9= z%%WbQ@&Yz`*)M*za-tO}?lqCeqVDQQhjZVQ{@Y4sL)~xr45^%UhTcZwWwv5ZM{vuv z84+QbXu$wNC^pQc9iG(86h?4um2= zeI#dZQhp5IXpEV^CQ;5;E^3Uz7Rh7z5(51x9M`7sSrHg>hU=cxu`nzzig zl<}uq;33~CB(fH`-%{>SKENdlj)`Xk0tt^V;%H<>nrf1hc|9}D=Mw$m<21DOL zRo-P<+<{$n1-0x~^Fm6d-u&*IC)Vs&kEl7d%@ufJ<}V0se5HXtsUF6?&$V)9Y;R&7xPrNTBC2WGUwR8R4CUp&SED~w_b2D}5!RtzT8Vij zm!rlg4QW&ax9uKETBN#FirXY!n9B#9gu5jc0xZV94evlhsmh2ket!-CF44t-YFCgn zi5gQM(OQnE-orcau{&2NY?Pli{w}o+<0~VcMqyL4uIEM_`9kf_m-mF9EjQ@q4sC3+ zhJg7S|KTD=JX}UsgHzP3K4W{xnz$#3^-D$+OkDGNXQt<>V}$QRoNJsfRKEu)zrDaN z^)+8Wmh@@wbMP@w;UT(F7UENps^8Rf_>|fz9b1~t?YPSD9!uQ2`p!x&S(#kQ?AJ}- z0($gomQDG)jSv?*Kf7ChQn&CQ>qAIUpMFLh(1vyNH2h_=cLtOKU(B12n^WHD4w&*p zDWMk_Z@;?hXi*cq{Z9=I8=9qr{GT2?I?P{n>&sVEkbkv*{D0n#zw96X8vp6%_{$9P z?@Rw~%J|Ft@z3D?GyKn`f3t%8{R)4XH~ud7{mZ=Z&*=Iy{O?PA{}(IAzXSeVaLV^j zv_GSwKflj^AMjr_#s7}>ckR-@q9y+E)cjwg{X^3F?`VHlTl_0p3;h2B+CS7$|Bm)| zF7%gzbySpV*T(7Y?ve&Ui9r~oL8Mb!89Ig>Qd)*mLPC&`5{rq#!TC=Y8?6rQ+zV_a?nj$g^2?ECDw+s^)C%268dyF$IGl5LXQ&TVhF)`=v)yn3XbWKFjL`7!EIw-wJM%V4Vl^VaXnch1{J>4s`mo zz^MA}8|?E(vYvh(qT=~4B~Hd=F8(NcMm{RZ9xGfjF*ovP}HFG-Qum zTvc>{USg?P(H^|z@)sB9x6VQ+rhH>Ue+Vq=v93`0B6{J5$W+q=(8fH<)=|%t-%@WY zb0@jK$+bzdqI%GeYTc+ZPU&huA{6N5(foljDFF7RAM4q+RnPas$X@QlG61dy|F{)F zg6a{gwgB;5Nf29hf?-$n453uoQM0OUT3E4X6fC&n-M9n!aAfrCVCWvHf_RRZM@jmI z`miNw%!%_uH9=ViRKw0@*A0`X8UYVK#BA`)1Tz{sQ)BK=*c8lhd6dv*{+}>0x)hf?ERqG_p{&dJ_JD7c!^02NR7r$mWcyVreDQ0jpvpI4E8!SHL!Ib!uN~aw z@BmJea)_kp)a(h-t+eQ}aW0SCji=2Fpj~QhbK@=>A)N+u55kLZ*#bi4n4*sx*vZPQ zT0rssukQMoHhGvMtb?%e&e7{UZRQ$AHpj+Vkz0Z>p4|~tp*81eK-+dl!`pXCp9^W* z-D!cK1INleXW9+L(v)Huyjk`hZ8buT&fcL|610Pyslo(sJspHh>w-+rKP+vDinV7W zdq!>mEVJsDb-!LT2~pqi8BB(IzHqQS6=^S7HF~>7+o!&pw@-uHcM{x2TQv9X(|r z5ral*M0B?~yl7mDI-H{(p|EI9=^>LRJe^qHXyOkH-DUH@I>x@@X1qbDW8sn;$c^04 z{xdg!(h@UsS!W2^8zI$;N$cZTb^-+>6%S35r=%CWWZ$DQ5@@L*iFJN+EjQpHubxCX zP4ng`W5+s2JXfFJU}Z)OqXE|P19!)doEk4q4^d}H7&8jZ3u|HOh5Ur;0bSZzMDH3s z7^L>}m1KknS97-3SM=K^qyvh1Sn0*RdxvGL9;VYZSH?TVy??FtG+X0c8Zp*pum9}h za2|7i!8o5PU3@i}TpaWRB#$A@Ahp#GS`AeAw-W1#)mz32&e_R2CCs{3_}_jg(oz}Q zERsL|!YX9Q+|J?nw1;%7VE5sv#oAhi%9w2tiaT01)QBGFA+Jm9#JyX$7w7nq&mzos zWEFL+)s(owVNx)qoU6%4^m{cXE})S%qExp*D|`63u}PC3SE^r8Gtr2dsgFgd^@*so z)hRFeNqPvelxJZLuJ7bhTJu~KTPqtMWUju6EtN_!t(uy2%5!dN>8D0m&bxIoycX3Xh`ScjwJ`HcnxJ0> z^?_pDMEHYyDZ4dw$+b*xldvT^siG2|z1TI2%m>ef-ENvA6y8`(@A-iIlL*2!g5CB@ zB5vPE1pR-AxMn_&{^~t;>UOq6Y9zk)$4L~UgQ4xTt>q;tJj>`bh&x_`q&}Y3!>K6ZS!~+1!*@~zCC|Y7Bp=yYRfqcolI~Mi7F#gBh>2iQB1Yo` zICm(zwabCx3%KHHM1H8Y2R4X5UEfEBf0)jIq1|`SdY4LX@$O;Jrul-)sVODoWn?En zWH8unz$!#e@e2|iJBd->?pw3ty{{P}d>zuFAB#iUISyAYsM9CKQZe>(xjpVYDUPt4 zN}!_&nkJoyI8XK_UkBf#^E~Ie&7Yv5tC*_Yyamk=7r~rjhgai5B(rmy?T{(u3KJ7! zSoq_Y5Owuls@|ExT%Y`+5(c0Udczg>CXgdfWjrZ!`JT91^8A+jH_EZu#-uy4oibti z)L(==nG_aHu@8v2E#KHSvPo~zz{tbhN%9|qgrW-`GUAQCS9}Sliinyav$su=F8iQ0 z0eU4O3}FjeZprOocNbQ1dii`YwzUh_*S2g*&IWY^cUyEv1X zlftp=bq~6Oe^p(SU4U5^mn>!8$P(S(vvkdj>@>G+hl~k)zx{YHK`~mGU7B1WQZQjr z13o|0+Ub^Hj}v~4f+879F%2BliYY6;=;VE7F54{LB(6}`T_ZQ)(^>C+Fa>e%ix&6u zJ4Y*iL5>vhDT=r|zQo0xA-1$)lQv>n;wdLoVsAL{-lJLQlYF7A+-(+4XQYY6-H@W_ zlzU;k497_3cv;#=pBH7?Htz@QH50i;`L|nwoafm%zQ4mUhbuI#d!D5H62jlI{Ym>jnF!InwCV?&>_;^*30%|%Ld?ud%3m|GQq6SVhgd}t@D+O-d? z4_VTmqa*EUyB_Cv0O+heLRCh<7d9NZL1DCQV#|uSu!KP;>`Fn6o=oki2MZm$PZUS8 zV@S8*N2ou1DUJsuXFrvw=Dp&P&7>p|!FqX1aWp+)*5G9U{7uJ@zW}c;&GBQl?U(&n zx#gccCai8BI{%T5Wz!48fgf!-0 z^(HR!mVF}xZPK_~TJhf(o&p8)P`g=rz;`AyC#iZm^9ASah#(`KDego+`V8GZb~qPG z7;Km`e-;=!EvhP}fQX-oedhm2wM0_W2?_PP0tzOiCx?oJfDm;fP^AA2)K8nT)3E)c z9gck^wo8lY1Co$hP?PZP|>o-yP zG#pZOL{lFjWil48^?rNZMd?;EXqpFH$ghj{p{ysA*Riz=_%c2_SP24sl|pj|o0XU_ z1=Zo+su;0bG+8gi<*xvAR&ku1pMZ)M&|&sDiXA49+3M*EYWXF$gv1qvV5Ie)YDCqq zDD@mqKF;9)A$qSW4j6myd{;AmThpIC@@SD>j~%4S0DGEBAN-0qU{GqSY}~p4v~YJ{ zTU&NBFCo9ZjfYN`=JNj#!u$+?MMdGsz$^M(^T?f4URYaL{)jP!$2l-JJ~|C;{mE1` zm$A^XkNCay8qf+vc^R77v`=)Ll!e%`)JE5pl|1Jcm$AGsppcvMmTYaV3{c)XI4`X^ z@q_0z+xzZb{Cwe{ZUd4sZjoMh68nn^sAg_pjrnEu8tIF3pMCVKmY zD#`gP-ER};!5S&I4ya1OxH0qXV9NwU`{lgu8vW0-5;}Bq)*7C70$7eb$BtS^Qmysa z4ASL4e1f#>K7+A*`U9`;tZv0Lmv|AO+|)&L{Rb~o2S-odUk0cKGPMO+nlnFg{L2jH zqha)7NP^^ktS_sDUA}8=P2tG&h}|u)_mdrSb@n({5X)?=(tH)rHYuL@_EjgXOZMjs zCQwGo==s_U)_Wh8Dx5gu=X;9eh?J0#5GJtO(&;jH#P=#7+^nK%c8=VarRMwxQ#2$s zjEW)<(h8e;;o-ehk8LmW`m35r@p78DijENuxWhQFg*()&L#?OK{IV!I-r;-=QAqEW zO)+|*6!^GP*P@70s{m*=H3BP-v)18lMHk&2 z0XaT0Sg8|3%zyAY);qnoi?l(0j(JDi(oo-gSP71 zfc+g^?W-XynCUB7bx`Frl>kF*L3bxN=4XRk=+^nDPo^(v;QesZ=oDE|Wz=c2M*qfO z)4?jbXLzezL$^58nejPHyCk1SIw!c14d*;vi7A`O*hs0teeSh&o95s%k@9FsyjAs< zds+P0nVcosL>WL(<8GoAfle~~ejYn(%K{_a>f?``Fkfj5*AX|rmO}|>kAdhw+3nBg zuF7`Sn1G0}@k}r*4o7t~j!xF~5o2{907cu#rK0H-jbS@uURj^bL=N33lms;Ww5i&VT3Un)d~%8#xeNj_|Fc@vfvO`fA{U z=cE-~$B{el2B6SkR>9;$GmFuZH#OX5?hJF{M()Z!i?MNPX;nQ{ayeb?yd=Xa;I0<$VTu=FR9~G?a}dU> zAko147l*z{9l|=#0&pq2L_lgdEUr95y^!E(b-85302T5Q5%Mno#~r$P2{@><^YBS!IFkn@H0RZd$y)mika2k6cduEn{EBeS+yW|YMn38*`5y;VXOOi5&6IMj< z4p`Xmw)V&L&-^rIVY)zpewA<`m6uHL`5nJ>oyOZ6Han3K_opn!=0WTlrpd{xO~Igk zY7r0rkfgcj$ITw)Na%J`rPdqBgYF`UEEyiR_Z)#2#d~{CDN{f+FBaM7tvRiZ-Q@hR zL$daZkcY(|Y$1C-Hv>+;2D~xR=7l~67_TX*D#DbX(hhCYe2(`D%k!#|=_!~{6fivC zqEg)O&d|qG7O@SkS5d;%Dpsx*(T^KYg0|C63Hn*jlOAwMt>_P(1=PFC=+=HZ7jhA} zU*h*zb5c$!R==!J9iS6e)-L$&f%@ok=7Y}QbhDUE+u3=2)zOsuRoR4ZPc%i5Pmr(Z zDWU}9Enm_TbR#{CH`DXe=z?Ml6saXi+Al02dZqTtWx3_$RDuJnC$q=)tJ0U_n0|(N zhN`(6?PgZ8^4K)WsY(OJbCYKL*^rpj@vJa4dCFyHi{7I*lcHkN;s|3Q(z>eVF*TBY zj&n~r)f=$1pE@x;dopjB#31#KORfc1)@93grMgPI2#hVM2pfeKEE{@v4|Ud+6bDyA zQ3+A_9#WyBSQbuy=>&bSTc8C9fHV^dg*e_s=;)SLF-)ekjGo`YTPzv0E;^T<9JON{ z+hmW~QD={laW+!Wq=&ZonRJRKdGv9dzAFCQuzM{OFB` z-|AG08)uG?u5*el_jJ1Rt3=-2nwSiw$3o-p+dg&@7q@4N<|XpLM4Nq0jLsgp`kHP6 zOGmfWhQM-9RH|zvn((^bi!W%iiQ3P^!Qh26Sm6_ih|kBDzVR=#2)uq;0VqypF?I~W z84>7T97j4syy8MuzJagvk_+ICT>N8I`JwS|~Es<{2DPry?GS-zq3s^qO2Ks!rd!HWUrh(+LMzRC*+vE@c) z>Q_;<}rmOUO+EgUin#Pl>LW>iH{$IF&#ZfG(KP#+2G#f{@#AyMS8+P-A!&9 z?KAB*TI7LqWHw9}QYN|$)Q5;3{%J`uiAn;YAC!;qv|opP_XstbRum(ha=>i1wA*G2 zkCGXyYbI8nG}$jwv{6(nw*E9iWnP<}MP8oug9EM?v?yjksO37KhpdC;NQ>^FVuT}R z`0OIF0U?)oY2|!wR%(kBX(ar$;fVfPQZgrh}cO{@}LE^j99Z}-74$rU& zEzsa7kp0zG=4gI#ViYQZuDo=0sD|5>8MT~$Kj!dhOX*qIFf^mum1^VjdU$Wc9(kND z!;$a2Lvz7EfJ?Q<%^+Jc7jfzcqqja>PTsE z_^C|ZNuI9SAZApBmG0z_4j>!=C}sd;meN*xgJ)A?>=W-bF@oChrK4@SH|*9OFpl?| zT98GxP#$!h4RrZndyNTs!rJqS@L>!kOXsVc={bv9IUt< zVO$5!Ry%q_8?F{M>Cae4*Q_A2ckj}~ zU2=2tKAGW0ZvL|xv{Rf^yR;%UpU@t@N$cqph}(p{ExhIM@y=(cWCplJ&bX*exo(Kd zT0f?2)*T*^4hGMnf0yp;RW5ym7Vk*kTMs+kx=4wwJ(;OQaGN6n@FiM2zDHx^(V(E6 z&h*NNCMr-qh&8nT9y#%xER)!t7&?sai&7lM$YT3}dL}DVEXo?8%`rn1lNP>K{zqx4 z-1S2!eBisxgsxPN6s0OyORb=}Nt1fnMTc$pgfl*^El`5>i7dfg*LUJLvWqWdtZVOa zTUv6mfcNQj>WjYOF0bjLtgnmG_3u1r*R&+&#VFWfs#;iAdaSS8js|)N%}^TZrEAtB z0r;8Btd5U;vc(-6G^ZvpFD(g%k&&Aw@A*+i#;W;hi7b_0fNE=Qq12MM^9etfNmAf> zXt$4&aamyprVjEi(t_-KtG`@8o9Pci+_P$1ZNuEBfT_1Do_ed+71oG@Y9nH)xofus z;~n~|x?0nA>SEq1rB>d1|GA^Q@3*ctqQ4>t?N6y+<012J`_bRUuJ1OkR${+m0ON1P zZpiWaAbYh9`4vpq|E2Z!xm}-St|s1J5rF%r#Q!$`{+{RcHutJ&`4!Fh|0;Y#&ez){ z#$TeBrwhUxb^kv9>(2St*CZ$T2f069?)OgX_w=t<)+^ur6`ExKrh7y7*FR2%Uz(Sv c7Zf+i{wI0VOJETYa4w&|%g;NF>gw130Y!pMo&W#< literal 0 HcmV?d00001 diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/Activator.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/Activator.java new file mode 100644 index 0000000000..19fd680b98 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/Activator.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2013 Stephan Herrmann 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: + * Stephan Herrmann - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.eclipse.core.runtime.Status; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +/** + * Make the PackageAdmin service accessible to tests. + * + * @deprecated uses deprecated class PackageAdmin. + */ +@SuppressWarnings({ "unchecked", "rawtypes" }) +public class Activator extends Plugin { + + private static final String PLUGIN_ID = "org.eclipse.jdt.core.tests.compiler"; + + static org.osgi.service.packageadmin.PackageAdmin packageAdmin = null; + + + public void start(BundleContext context) throws Exception { + + ServiceReference ref= context.getServiceReference(org.osgi.service.packageadmin.PackageAdmin.class.getName()); + if (ref!=null) + packageAdmin = (org.osgi.service.packageadmin.PackageAdmin)context.getService(ref); + else + getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, "Failed to load PackageAdmin service. Will not be able to access bundles org.eclipse.jdt.annotation.")); + } + + public void stop(BundleContext context) throws Exception { + // nothing + } + + public static org.osgi.service.packageadmin.PackageAdmin getPackageAdmin() { + return packageAdmin; + } + +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/CharDeduplicationTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/CharDeduplicationTest.java new file mode 100644 index 0000000000..92fa0a2ae2 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/CharDeduplicationTest.java @@ -0,0 +1,187 @@ +/******************************************************************************* + * Copyright (c) 2021 jkubitz 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: + * jkubitz - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler; + +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.FutureTask; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.LongStream; + +import org.eclipse.jdt.core.tests.junit.extension.TestCase; +import org.eclipse.jdt.internal.compiler.util.CharDeduplication; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class CharDeduplicationTest extends TestCase { + + public CharDeduplicationTest(String testName) { + super(testName); + } + + public static Test suite() { + + TestSuite suite = new TestSuite(CharDeduplicationTest.class.getPackageName()); + suite.addTest(new TestSuite(CharDeduplicationTest.class)); + return suite; + } + + public void testDeduplication() { + for (int i = 0; i < 3; i++) { + assertDeduplication("a"); + // .. + assertDeduplication("z"); + + assertDeduplication("12"); + assertDeduplication("123"); + assertDeduplication("1234"); + assertDeduplication("12345"); + assertDeduplication("123456"); + assertNoDeduplication("1234567"); + + // new: + assertDeduplication("0"); // illegal identifier - but who cares. + assertDeduplication("A"); // why not? + assertDeduplication("$"); // legal + assertDeduplication("_"); // note that "_" may become more common after JEP 302 as keyword for unused + // lambda parameter! + assertDeduplication("" + (char) 0); + // .. + assertDeduplication("" + (char) 127); + assertNoDeduplication("" + (char) 128); // non-Ascii + } + } + + public void testDeduplicationMid() { + String text = "abcdefghijklmn"; + for (int start = 0; start < text.length(); start++) { + for (int end = start; end < text.length(); end++) { + assertDedup(text, (end - start) <= CharDeduplication.OPTIMIZED_LENGTH, start, end); + } + } + } + + @SuppressWarnings("deprecation") + public void testDeduplicationTableSize() { + CharDeduplication deduplication = CharDeduplication.getThreadLocalInstance(); + deduplication.reset();// to test the overflow we need to start empty + for (int overload = 0; overload < 3; overload++) { + HashMap expecteds = new HashMap<>(); + for (int i = 0; i < CharDeduplication.TABLE_SIZE + overload; i++) { + int numberWithFixedLength = 10000 + i; + String string = "" + numberWithFixedLength; + char[] a = string.toCharArray(); + char[] expected = deduplication.sharedCopyOfRange(a, 0, a.length); + expecteds.put(i, expected); + } + for (int t = 0; t < 2; t++) { + for (int i = 0; i < expecteds.size(); i++) { + char[] expected = expecteds.get(i); + char[] other = String.valueOf(expected).toCharArray(); + if (overload == 0 || i > 0) { + assertDedup(true, 0, expected.length, expected, other); + } else { + // situation after table overflow: + char[] actual = deduplication.sharedCopyOfRange(other, 0, expected.length); + // both actual == expected or actual != expected may happen + // but we can assert that the next deduplication works again: + char[] other2 = String.valueOf(expected).toCharArray(); + assertDedup(true, 0, expected.length, actual, other2); + } + } + } + } + } + + public static void main(String[] args) { + CharDeduplicationTest test=new CharDeduplicationTest(""); + System.out.println("min= ~"+ LongStream.range(0, 100).map(t->test.runPerformanceTest()).min()); + // min= ~0.36sec + } + + public long runPerformanceTest() { + long nanoTime = System.nanoTime(); + CharDeduplication deduplication = CharDeduplication.getThreadLocalInstance(); + for (int j = 0; j < 100; j++) { + for (int i = 0; i < 100_000; i++) { + String hexString = Integer.toHexString(i); + char[] chars = hexString.toCharArray(); + deduplication.sharedCopyOfRange(chars, 0, chars.length); + } + } + long nanoTime2 = System.nanoTime(); + long durationNanos = nanoTime2 - nanoTime; + System.out.println(durationNanos); + return durationNanos; + } + + public void testAll() { + testDeduplication(); + testDeduplicationMid(); + testDeduplicationTableSize(); + } + + public void testMultithreaded() throws Exception { + int nThreads = 8; + List> tasks = IntStream.range(0, nThreads * 2).mapToObj(i -> new FutureTask(() -> { + testAll(); + return null; + })).collect(Collectors.toList()); + ExecutorService executor = Executors.newFixedThreadPool(nThreads); + tasks.forEach(executor::submit); + for (FutureTask task : tasks) { + try { + task.get(); + } catch (Exception e) { + throw new AssertionError(e); + } + } + executor.shutdownNow(); + } + + private void assertDeduplication(String string) { + assertDedup(string, true, 0, string.length()); + } + + private void assertNoDeduplication(String string) { + assertDedup(string, false, 0, string.length()); + } + + private void assertDedup(String string, boolean same, int startPosition, int end) { + char[] a = string.toCharArray(); + char[] b = string.toCharArray(); + assertNotSame(a, b); + CharDeduplication deduplication = CharDeduplication.getThreadLocalInstance(); + char[] expected = deduplication.sharedCopyOfRange(a, startPosition, end); + assertDedup(same, startPosition, end, expected, b); + } + + private char[] assertDedup(boolean same, int startPosition, int end, char[] expected, char[] other) { + assertNotSame(expected, other); + CharDeduplication deduplication = CharDeduplication.getThreadLocalInstance(); + char[] actual = deduplication.sharedCopyOfRange(other, startPosition, end); + String state = "expected=" + String.valueOf(expected) + ", actual=" + String.valueOf(actual); + if (same) { + assertSame(state, expected, actual); + } else { + assertNotSame("Expected different instances. But thats not a requirement but an implementation detail test:" + + state, expected, actual); + } + return actual; + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/DeduplicationUtilTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/DeduplicationUtilTest.java new file mode 100644 index 0000000000..2fab70e4d8 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/DeduplicationUtilTest.java @@ -0,0 +1,146 @@ +/******************************************************************************* + * Copyright (c) 2021 jkubitz 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: + * jkubitz - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler; + +import java.util.List; +import java.util.function.Supplier; + +import org.eclipse.jdt.core.tests.junit.extension.TestCase; +import org.eclipse.jdt.internal.core.util.DeduplicationUtil; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class DeduplicationUtilTest extends TestCase { + + public DeduplicationUtilTest(String testName) { + super(testName); + } + + public static Test suite() { + TestSuite suite = new TestSuite(DeduplicationUtilTest.class.getPackageName()); + suite.addTest(new TestSuite(DeduplicationUtilTest.class)); + return suite; + } + + public void testDeduplication() { + assertDeduplicationString("aNeverUsedBefore".toCharArray()); + assertDeduplicationCharArray("aNeverUsedBefore"); + assertDeduplicationObject(() -> List.of("aNeverUsedBefore")); + + assertDeduplicationString("bNeverUsedBefore".toCharArray()); + assertDeduplicationCharArray("bNeverUsedBefore"); + assertDeduplicationObject(() -> List.of("bNeverUsedBefore")); + } + + private void assertDeduplicationString(char[] stringTemplate) { + // do not change order of weak/strong test, + { // test weak behaviour: + String a = new String(stringTemplate); + String b = new String(stringTemplate); + assertNotSame(a, b); + String expected = DeduplicationUtil.intern(b); + assertSame(b, expected); + b = null; + expected = null; + forceGc(); + String actual = DeduplicationUtil.intern(a); + assertSame(a, actual); // i.e. actual != expected since "expected" was garbage collected. + } + { // test strong: + String a = new String(stringTemplate); + String b = new String(stringTemplate); + assertNotSame(a, b); + String actual = DeduplicationUtil.intern(a); + String expected = DeduplicationUtil.intern(b); + assertSame(expected, actual); + } + } + + private void assertDeduplicationCharArray(String charArrayTemplate) { + { // weak + char[] a = charArrayTemplate.toCharArray(); + char[] b = charArrayTemplate.toCharArray(); + assertNotSame(a, b); + char[] expected = DeduplicationUtil.intern(b); + assertSame(b, expected); + b = null; + expected = null; + forceGc(); + char[] actual = DeduplicationUtil.intern(a); + assertSame(a, actual); + } + { // strong + char[] a = charArrayTemplate.toCharArray(); + char[] b = charArrayTemplate.toCharArray(); + assertNotSame(a, b); + char[] actual = DeduplicationUtil.intern(a); + char[] expected = DeduplicationUtil.intern(b); + assertSame(expected, actual); + } + } + + private void assertDeduplicationObject(Supplier supplier) { + { // weak + Object a = supplier.get(); + Object b = supplier.get(); + assertNotSame(a, b); + assertEquals(a, b); + Object expected = DeduplicationUtil.internObject(b); + assertSame(b, expected); + b = null; + expected = null; + + forceGc(); + + // Now "b" is not referenced anymore, can be garbage collected + // and DeduplicationUtil is supposed to release weak reference to it + // so after trying to intern "a" we will get "a" and not previously set "b" + Object actual = DeduplicationUtil.internObject(a); + + // It is impossible to rely on GC to run immediately, so loop few times + for (int i = 0; i < 42; i++) { + if(actual != a) { + forceGc(); + actual = DeduplicationUtil.internObject(a); + } else { + break; + } + } + assertSame(a, actual); + } + { // strong + Object a = supplier.get(); + Object b = supplier.get(); + assertNotSame(a, b); + assertEquals(a, b); + Object actual = DeduplicationUtil.internObject(a); + Object expected = DeduplicationUtil.internObject(b); + + // since "a" is still referenced, we should get it + assertSame(expected, actual); + } + } + + private void forceGc() { + System.gc(); + System.runFinalization(); + try { + // give gc some time to run + Thread.sleep(500); + } catch (InterruptedException e) { + // don't care + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/map/CharArrayMapperTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/map/CharArrayMapperTest.java new file mode 100644 index 0000000000..d977b1968a --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/map/CharArrayMapperTest.java @@ -0,0 +1,263 @@ +/******************************************************************************* + * Copyright (c) 2021 jkubitz 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: + * jkubitz - initial API and implementation + *******************************************************************************/ +package org.eclipse.jdt.core.tests.compiler.map; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; + +import org.eclipse.jdt.core.tests.junit.extension.TestCase; +import org.eclipse.jdt.internal.compiler.util.CharArrayHashMap; +import org.eclipse.jdt.internal.compiler.util.CharArrayMap; +import org.eclipse.jdt.internal.compiler.util.CharArrayMapper; +import org.eclipse.jdt.internal.compiler.util.CharDelegateMap; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class CharArrayMapperTest extends TestCase { + public CharArrayMapperTest(String testName) { + super(testName); + } + public static Test suite() { + + TestSuite suite = new TestSuite(CharArrayMapperTest.class.getPackageName()); + suite.addTest(new TestSuite(CharArrayMapperTest.class)); + return suite; + } + void testPutNew(CharArrayMapper map, String keyString) { + int oldSize = map.size(); + String value = "_" + keyString + "_"; + String previous = map.put(keyString.toCharArray(), value); + int newSize = map.size(); + assertEquals("testPutNew1(" + keyString + ")", null, previous); + String vinside = map.get(keyString.toCharArray()); + assertEquals("testPutNew2(" + keyString + ")", value, vinside); + assertEquals("testPutNew3(" + keyString + ")", oldSize+1, newSize); + assertEquals("testPutNew4(" + keyString + ")", map.keys().size(), newSize); + assertEquals("testPutNew5(" + keyString + ")", map.values().size(), newSize); + } + + void testPutExisting(CharArrayMapper map, String keyString) { + int oldSize = map.size(); + String value = "_new_" + keyString + "_"; + String previous = map.get(keyString.toCharArray()); + String returned = map.put(keyString.toCharArray(), value); + int newSize = map.size(); + assertEquals("testPutExisting1(" + keyString + ")", previous, returned); + assertEquals("testPutNew3(" + keyString + ")", oldSize, newSize); + assertEquals("testPutNew4(" + keyString + ")", map.keys().size(), oldSize); + assertEquals("testPutNew5(" + keyString + ")", map.values().size(), oldSize); + map.put(keyString.toCharArray(), previous); // restore + } + + void testGetExisting(CharArrayMapper map, String keyString) { + String value = "_" + keyString + "_"; + String vinside = map.get(keyString.toCharArray()); + assertEquals("testGetExisting1(" + keyString + ")", value, vinside); + assertEquals("testGetExisting2(" + keyString + ")", true, map.values().contains(value)); + assertEquals("testGetExisting3(" + keyString + ")", true, + map.keys().stream().anyMatch(k -> Arrays.equals(k, keyString.toCharArray()))); + } + + void testGetNonExisting(CharArrayMapper map, String keyString) { + String value = "_" + keyString + "_"; + String vinside = map.get(keyString.toCharArray()); + assertEquals("testGetNonExisting1(" + keyString + ")", null, vinside); + assertEquals("testGetNonExisting1(" + keyString + ")", false, map.values().contains(value)); + assertEquals("testGetNonExisting1(" + keyString + ")", false, + map.keys().stream().anyMatch(k -> Arrays.equals(k, keyString.toCharArray()))); + } + + + void testIntList(CharArrayMapper map) { + assertEquals("empty", Collections.emptyList(), map.keys()); + int N = 100; + for (int i = 0; i < N; i++) { + testPutNew(map, "" + i); + testPutExisting(map, "" + i); + testGetExisting(map, "" + i); + } + for (int i = 0; i < N; i++) { + testGetExisting(map, "" + i); + } + for (int i = N + 1; i < N * 2; i++) { + testGetNonExisting(map, "" + i); + } + } + + void testColliding(CharArrayMapper map) { + assertEquals("empty", Collections.emptyList(), map.keys()); + for (int[] collision : hashCollisions) { + int h1 = Arrays.hashCode(("" + collision[0]).toCharArray()); + int h2 = Arrays.hashCode(("" + collision[1]).toCharArray()); + assertEquals("collision(" + collision[0] + "<->" + collision[1] + ")", h1, h2); + for (int i : collision) { + testPutNew(map, "" + i); + testPutExisting(map, "" + i); + testGetExisting(map, "" + i); + } + } + for (int[] collision : hashCollisions) { + for (int i : collision) { + testGetExisting(map, "" + i); + } + } + int N = 100; + for (int i = N + 1; i < N * 2; i++) { + testGetNonExisting(map, "" + i); + } + } + + public void testCharArrayHashMap() { + testIntList(new CharArrayHashMap<>(4)); + testColliding(new CharArrayHashMap<>(4)); + } + + public void testCharArrayMap() { + testIntList(new CharArrayMap<>()); + testColliding(new CharArrayMap<>()); + } + + public void testCharDelegateMap() { + testIntList(new CharDelegateMap<>()); + testColliding(new CharDelegateMap<>()); + } + + static int[][] hashCollisions = { { 17510, 37760009 }, { 17520, 37760019 }, { 17530, 37760029 }, + { 17540, 37760039 }, { 17550, 37760049 }, { 17560, 37760059 }, { 17570, 37760069 }, { 17580, 37760079 }, + { 17590, 37760089 }, { 17610, 37760109 }, { 17620, 37760119 }, { 17630, 37760129 }, { 17640, 37760139 }, + { 17650, 37760149 }, { 17660, 37760159 }, { 17670, 37760169 }, { 17680, 37760179 }, { 17690, 37760189 }, + { 17710, 37760209 }, { 17720, 37760219 }, { 17730, 37760229 }, { 17740, 37760239 }, { 17750, 37760249 }, + { 17760, 37760259 }, { 17770, 37760269 }, { 17780, 37760279 }, { 17790, 37760289 }, { 17810, 37760309 }, + { 17820, 37760319 }, { 17830, 37760329 }, { 17840, 37760339 }, { 17850, 37760349 }, { 17860, 37760359 }, + { 17870, 37760369 }, { 17880, 37760379 }, { 17890, 37760389 }, { 17910, 37760409 }, { 17920, 37760419 }, + { 17930, 37760429 }, { 17940, 37760439 }, { 17950, 37760449 }, { 17960, 37760459 }, { 17970, 37760469 }, + { 17980, 37760479 }, { 17990, 37760489 }, { 18510, 37761009 }, { 18520, 37761019 }, { 18530, 37761029 }, + { 18540, 37761039 }, { 18550, 37761049 }, { 18560, 37761059 }, { 18570, 37761069 }, { 18580, 37761079 }, + { 18590, 37761089 }, { 18610, 37761109 }, { 18620, 37761119 }, { 18630, 37761129 }, { 18640, 37761139 }, + { 18650, 37761149 }, { 18660, 37761159 }, { 18670, 37761169 }, { 18680, 37761179 }, { 18690, 37761189 }, + { 18710, 37761209 }, { 18720, 37761219 }, { 18730, 37761229 }, { 18740, 37761239 }, { 18750, 37761249 }, + { 18760, 37761259 }, { 18770, 37761269 }, { 18780, 37761279 }, { 18790, 37761289 }, { 18810, 37761309 }, + { 18820, 37761319 }, { 18830, 37761329 }, { 18840, 37761339 }, { 18850, 37761349 }, { 18860, 37761359 }, + { 18870, 37761369 }, { 18880, 37761379 }, { 18890, 37761389 }, { 18910, 37761409 }, { 18920, 37761419 }, + { 18930, 37761429 }, { 18940, 37761439 }, { 18950, 37761449 }, { 18960, 37761459 }, { 18970, 37761469 }, + { 18980, 37761479 }, { 18990, 37761489 }, { 19510, 37762009 }, { 19520, 37762019 }, { 19530, 37762029 }, + { 19540, 37762039 }, { 19550, 37762049 }, { 19560, 37762059 }, { 19570, 37762069 }, { 19580, 37762079 }, + { 19590, 37762089 }, { 19610, 37762109 }, { 19620, 37762119 }, { 19630, 37762129 }, { 19640, 37762139 }, + { 19650, 37762149 }, { 19660, 37762159 }, { 19670, 37762169 }, { 19680, 37762179 }, { 19690, 37762189 }, + { 19710, 37762209 }, { 19720, 37762219 }, { 19730, 37762229 }, { 19740, 37762239 }, { 19750, 37762249 }, + { 19760, 37762259 }, { 19770, 37762269 }, { 19780, 37762279 }, { 19790, 37762289 }, { 19810, 37762309 }, + { 19820, 37762319 }, { 19830, 37762329 }, { 19840, 37762339 }, { 19850, 37762349 }, { 19860, 37762359 }, + { 19870, 37762369 }, { 19880, 37762379 }, { 19890, 37762389 }, { 19910, 37762409 }, { 19920, 37762419 }, + { 19930, 37762429 }, { 19940, 37762439 }, { 19950, 37762449 }, { 19960, 37762459 }, { 19970, 37762469 }, + { 19980, 37762479 }, { 19990, 37762489 }, { 27510, 37770009 }, { 27520, 37770019 }, { 27530, 37770029 }, + { 27540, 37770039 }, { 27550, 37770049 }, { 27560, 37770059 }, { 27570, 37770069 }, { 27580, 37770079 }, + { 27590, 37770089 }, { 27610, 37770109 }, { 27620, 37770119 }, { 27630, 37770129 }, { 27640, 37770139 }, + { 27650, 37770149 }, { 27660, 37770159 }, { 27670, 37770169 }, { 27680, 37770179 }, { 27690, 37770189 }, + { 27710, 37770209 }, { 27720, 37770219 }, { 27730, 37770229 }, { 27740, 37770239 }, { 27750, 37770249 }, + { 27760, 37770259 }, { 27770, 37770269 }, { 27780, 37770279 }, { 27790, 37770289 }, { 27810, 37770309 }, + { 27820, 37770319 }, { 27830, 37770329 }, { 27840, 37770339 }, { 27850, 37770349 }, { 27860, 37770359 }, + { 27870, 37770369 }, { 27880, 37770379 }, { 27890, 37770389 }, { 27910, 37770409 }, { 27920, 37770419 }, + { 27930, 37770429 }, { 27940, 37770439 }, { 27950, 37770449 }, { 27960, 37770459 }, { 27970, 37770469 }, + { 27980, 37770479 }, { 27990, 37770489 }, { 28510, 37771009 }, { 28520, 37771019 }, { 28530, 37771029 }, + { 28540, 37771039 }, { 28550, 37771049 }, { 28560, 37771059 }, { 28570, 37771069 }, { 28580, 37771079 }, + { 28590, 37771089 }, { 28610, 37771109 }, { 28620, 37771119 }, { 28630, 37771129 }, { 28640, 37771139 }, + { 28650, 37771149 }, { 28660, 37771159 }, { 28670, 37771169 }, { 28680, 37771179 }, { 28690, 37771189 }, + { 28710, 37771209 }, { 28720, 37771219 }, { 28730, 37771229 }, { 28740, 37771239 }, { 28750, 37771249 }, + { 28760, 37771259 }, { 28770, 37771269 }, { 28780, 37771279 }, { 28790, 37771289 }, { 28810, 37771309 }, + { 28820, 37771319 }, { 28830, 37771329 }, { 28840, 37771339 }, { 28850, 37771349 }, { 28860, 37771359 }, + { 28870, 37771369 }, { 28880, 37771379 }, { 28890, 37771389 }, { 28910, 37771409 }, { 28920, 37771419 }, + { 28930, 37771429 }, { 28940, 37771439 }, { 28950, 37771449 }, { 28960, 37771459 }, { 28970, 37771469 }, + { 28980, 37771479 }, { 28990, 37771489 }, { 29510, 37772009 }, { 29520, 37772019 }, { 29530, 37772029 }, + { 29540, 37772039 }, { 29550, 37772049 }, { 29560, 37772059 }, { 29570, 37772069 }, { 29580, 37772079 }, + { 29590, 37772089 }, { 29610, 37772109 }, { 29620, 37772119 }, { 29630, 37772129 }, { 29640, 37772139 }, + { 29650, 37772149 }, { 29660, 37772159 }, { 29670, 37772169 }, { 29680, 37772179 }, { 29690, 37772189 }, + { 29710, 37772209 }, { 29720, 37772219 }, { 29730, 37772229 }, { 29740, 37772239 }, { 29750, 37772249 }, + { 29760, 37772259 }, { 29770, 37772269 }, { 29780, 37772279 }, { 29790, 37772289 }, { 29810, 37772309 }, + { 29820, 37772319 }, { 29830, 37772329 }, { 29840, 37772339 }, { 29850, 37772349 }, { 29860, 37772359 }, + { 29870, 37772369 }, { 29880, 37772379 }, { 29890, 37772389 }, { 29910, 37772409 }, { 29920, 37772419 }, + { 29930, 37772429 }, { 29940, 37772439 }, { 29950, 37772449 }, { 29960, 37772459 }, { 29970, 37772469 }, + { 29980, 37772479 }, { 29990, 37772489 }, { 37510, 37780009 }, { 37520, 37780019 }, { 37530, 37780029 }, + { 37540, 37780039 }, { 37550, 37780049 }, { 37560, 37780059 }, { 37570, 37780069 }, { 37580, 37780079 }, + { 37590, 37780089 }, { 37610, 37780109 }, { 37620, 37780119 }, { 37630, 37780129 }, { 37640, 37780139 }, + { 37650, 37780149 }, { 37660, 37780159 }, { 37670, 37780169 }, { 37680, 37780179 }, { 37690, 37780189 }, + { 37710, 37780209 }, { 37720, 37780219 }, { 37730, 37780229 }, { 37740, 37780239 }, { 37750, 37780249 }, { 37760, 37780259 }, { 37770, 37780269 }, { 37780, 37780279 }, { 37790, 37780289 }, { 37810, 37780309 }, + { 37820, 37780319 }, { 37830, 37780329 }, { 37840, 37780339 }, { 37850, 37780349 }, { 37860, 37780359 }, + { 37870, 37780369 }, { 37880, 37780379 }, { 37890, 37780389 }, { 37910, 37780409 }, { 37920, 37780419 }, + { 37930, 37780429 }, { 37940, 37780439 }, { 37950, 37780449 }, { 37960, 37780459 }, { 37970, 37780469 }, + { 37980, 37780479 }, { 37990, 37780489 }, { 38510, 37781009 }, { 38520, 37781019 }, { 38530, 37781029 }, + { 38540, 37781039 }, { 38550, 37781049 }, { 38560, 37781059 }, { 38570, 37781069 }, { 38580, 37781079 }, + { 38590, 37781089 }, { 38610, 37781109 }, { 38620, 37781119 }, { 38630, 37781129 }, { 38640, 37781139 }, + { 38650, 37781149 }, { 38660, 37781159 }, { 38670, 37781169 }, { 38680, 37781179 }, { 38690, 37781189 }, + { 38710, 37781209 }, { 38720, 37781219 }, { 38730, 37781229 }, { 38740, 37781239 }, { 38750, 37781249 }, + { 38760, 37781259 }, { 38770, 37781269 }, { 38780, 37781279 }, { 38790, 37781289 }, { 38810, 37781309 }, + { 38820, 37781319 }, { 38830, 37781329 }, { 38840, 37781339 }, { 38850, 37781349 }, { 38860, 37781359 }, + { 38870, 37781369 }, { 38880, 37781379 }, { 38890, 37781389 }, { 38910, 37781409 }, { 38920, 37781419 }, + { 38930, 37781429 }, { 38940, 37781439 }, { 38950, 37781449 }, { 38960, 37781459 }, { 38970, 37781469 }, + { 38980, 37781479 }, { 38990, 37781489 }, { 39510, 37782009 }, { 39520, 37782019 }, { 39530, 37782029 }, + { 39540, 37782039 }, { 39550, 37782049 }, { 39560, 37782059 }, { 39570, 37782069 }, { 39580, 37782079 }, + { 39590, 37782089 }, { 39610, 37782109 }, { 39620, 37782119 }, { 39630, 37782129 }, { 39640, 37782139 }, + { 39650, 37782149 }, { 39660, 37782159 }, { 39670, 37782169 }, { 39680, 37782179 }, { 39690, 37782189 }, + { 39710, 37782209 }, { 39720, 37782219 }, { 39730, 37782229 }, { 39740, 37782239 }, { 39750, 37782249 }, + { 39760, 37782259 }, { 39770, 37782269 }, { 39780, 37782279 }, { 39790, 37782289 }, { 39810, 37782309 }, + { 39820, 37782319 }, { 39830, 37782329 }, { 39840, 37782339 }, { 39850, 37782349 }, { 39860, 37782359 }, + { 39870, 37782369 }, { 39880, 37782379 }, { 39890, 37782389 }, { 39910, 37782409 }, { 39920, 37782419 }, + { 39930, 37782429 }, { 39940, 37782439 }, { 39950, 37782449 }, { 39960, 37782459 }, { 39970, 37782469 }, + { 39980, 37782479 }, { 39990, 37782489 }, { 47510, 37790009 }, { 47520, 37790019 }, { 47530, 37790029 }, + { 47540, 37790039 }, { 47550, 37790049 }, { 47560, 37790059 }, { 47570, 37790069 }, { 47580, 37790079 }, + { 47590, 37790089 }, { 47610, 37790109 }, { 47620, 37790119 }, { 47630, 37790129 }, { 47640, 37790139 }, + { 47650, 37790149 }, { 47660, 37790159 }, { 47670, 37790169 }, { 47680, 37790179 }, { 47690, 37790189 }, + { 47710, 37790209 }, { 47720, 37790219 }, { 47730, 37790229 }, { 47740, 37790239 }, { 47750, 37790249 }, + { 47760, 37790259 }, { 47770, 37790269 }, { 47780, 37790279 }, { 47790, 37790289 }, { 47810, 37790309 }, + { 47820, 37790319 }, { 47830, 37790329 }, { 47840, 37790339 }, { 47850, 37790349 }, { 47860, 37790359 }, + { 47870, 37790369 }, { 47880, 37790379 }, { 47890, 37790389 }, { 47910, 37790409 }, { 47920, 37790419 }, + { 47930, 37790429 }, { 47940, 37790439 }, { 47950, 37790449 }, { 47960, 37790459 }, { 47970, 37790469 }, + { 47980, 37790479 }, { 47990, 37790489 }, { 48510, 37791009 }, { 48520, 37791019 }, { 48530, 37791029 }, + { 48540, 37791039 }, { 48550, 37791049 }, { 48560, 37791059 }, { 48570, 37791069 }, { 48580, 37791079 }, + { 48590, 37791089 }, { 48610, 37791109 }, { 48620, 37791119 }, { 48630, 37791129 }, { 48640, 37791139 }, + { 48650, 37791149 }, { 48660, 37791159 }, { 48670, 37791169 }, { 48680, 37791179 }, { 48690, 37791189 }, + { 48710, 37791209 }, { 48720, 37791219 }, { 48730, 37791229 }, { 48740, 37791239 }, { 48750, 37791249 }, + { 48760, 37791259 }, { 48770, 37791269 }, { 48780, 37791279 }, { 48790, 37791289 }, { 48810, 37791309 }, + { 48820, 37791319 }, { 48830, 37791329 }, { 48840, 37791339 }, { 48850, 37791349 }, { 48860, 37791359 }, + { 48870, 37791369 }, { 48880, 37791379 }, { 48890, 37791389 }, { 48910, 37791409 }, { 48920, 37791419 }, + { 48930, 37791429 }, { 48940, 37791439 }, { 48950, 37791449 }, { 48960, 37791459 }, { 48970, 37791469 }, + { 48980, 37791479 }, { 48990, 37791489 }, { 49510, 37792009 }, { 49520, 37792019 }, { 49530, 37792029 }, + { 49540, 37792039 }, { 49550, 37792049 }, { 49560, 37792059 }, { 49570, 37792069 }, { 49580, 37792079 }, + { 49590, 37792089 }, { 49610, 37792109 }, { 49620, 37792119 }, { 49630, 37792129 }, { 49640, 37792139 }, + { 49650, 37792149 }, { 49660, 37792159 }, { 49670, 37792169 }, { 49680, 37792179 }, { 49690, 37792189 }, + { 49710, 37792209 }, { 49720, 37792219 }, { 49730, 37792229 }, { 49740, 37792239 }, { 49750, 37792249 }, + { 49760, 37792259 }, { 49770, 37792269 }, { 49780, 37792279 }, { 49790, 37792289 }, { 49810, 37792309 }, + { 49820, 37792319 }, { 49830, 37792329 }, { 49840, 37792339 }, { 49850, 37792349 }, { 49860, 37792359 }, + { 49870, 37792369 }, { 49880, 37792379 }, { 49890, 37792389 }, { 49910, 37792409 }, { 49920, 37792419 }, + { 49930, 37792429 }, { 49940, 37792439 }, { 49950, 37792449 }, { 49960, 37792459 }, { 49970, 37792469 }, + { 49980, 37792479 }, { 49990, 37792489 } }; + + /* calculate hashCollisions used above: */ + public static void main(String[] args) { + int N = 100000000; + HashMap> hashCollisions_ = new HashMap<>(); + for (int i = 0; i < N; i++) { + char[] key = ("" + i).toCharArray(); + Integer hashCode = Arrays.hashCode(key); + List l = hashCollisions_.computeIfAbsent(hashCode, h -> new ArrayList<>()); + l.add(i); + if (l.size() > 1) { + System.out.println(l.size() + " collissions:" + hashCode + "->" + l); + } + } + } +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java new file mode 100644 index 0000000000..e5c8b3d767 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractCompletionTest.java @@ -0,0 +1,457 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 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.compiler.parser; + +import java.util.Locale; + +import org.eclipse.jdt.internal.codeassist.complete.CompletionOnMemberAccess; +import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; +import org.eclipse.jdt.internal.codeassist.complete.CompletionScanner; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Initializer; +import org.eclipse.jdt.internal.compiler.ast.ThisReference; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; + +public abstract class AbstractCompletionTest extends AbstractCompilerTest { + + public final static String NONE = ""; + public final static String NULL = "null"; +public AbstractCompletionTest(String testName){ + super(testName); +} +/* + * DietParse with completionNode check + */ +public void checkDietParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + this.checkDietParse( + source, + cursorLocation, + expectedCompletion, + null, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName); +} +/* + * DietParse with completionNode check + */ +public void checkDietParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + CompletionParser parser = + new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation); + + checkParse( + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName, + parser, + unit); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String[] expectedLabels, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + CompletionParser parser = + new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, cursorLocation); + + ASTNode foundMethod = null; + if (unit.types != null) { + for (int i = 0; i < unit.types.length; i++) { + TypeDeclaration type = unit.types[i]; + ASTNode method = findMethod(type, cursorLocation); + if (method != null) { + foundMethod = method; + break; + } + } + } + + if (foundMethod != null) { + if (foundMethod instanceof AbstractMethodDeclaration) { + parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit); + } else { + TypeDeclaration type = (TypeDeclaration)foundMethod; + FieldDeclaration[] fields = type.fields; + if (fields != null) { + done : for (int i = 0; i < fields.length; i++) { + FieldDeclaration field = fields[i]; + if (field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) { + if (field instanceof Initializer) { + parser.parseBlockStatements((Initializer)field, type, unit); + break; + } + break done; // field initializer + } + } + } + } + } + + checkParse( + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName, + parser, + unit); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + this.checkMethodParse( + source, + cursorLocation, + expectedCompletion, + null, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + null, + testName); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + this.checkMethodParse( + source, + cursorLocation, + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + null, + testName); +} +/* + * Parse a method with completionNode check + */ +public void checkMethodParse( + char[] source, + int cursorLocation, + String expectedCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String[] expectedLabels, + String testName) { + + this.checkMethodParse( + source, + cursorLocation, + expectedCompletion, + null, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource, + expectedLabels, + testName); +} +private void checkParse( + String expectedCompletion, + String expectedParentCompletion, + String expectedUnitToString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName, + CompletionParser parser, + CompilationUnitDeclaration unit) { + String computedCompletion = parser.assistNode == null + ? NONE + : parser.assistNode.toString(); + + String computedParentCompletion = NULL; + if (expectedParentCompletion != null) { + computedParentCompletion = parser.assistNodeParent == null + ? NONE + : parser.assistNodeParent.toString(); + } + + String computedUnitToString = unit.toString(); + //System.out.println(computedUnitToString); + //System.out.println(Util.displayString(computedUnitToString)); + //System.out.println(expectedUnitToString); + + if (!expectedCompletion.equals(computedCompletion)) { + System.out.println(Util.displayString(computedCompletion)); + } + + if(expectedParentCompletion != null) { + if (!expectedParentCompletion.equals(computedParentCompletion)) { + System.out.println(Util.displayString(computedParentCompletion)); + } + } + + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString)); + } + + String computedCompletionIdentifier = NULL; + if (expectedCompletionIdentifier != null){ + char[] chars = ((CompletionScanner)parser.scanner).completionIdentifier; + computedCompletionIdentifier = chars == null ? NONE : new String(chars); + } + + String computedReplacedSource = NULL; + if (expectedReplacedSource != null){ + char[] chars = null; + if (parser.assistNode != null){ + int start = parser.assistNode.sourceStart; + int end = parser.assistNode.sourceEnd; + if (parser.assistNode instanceof CompletionOnMemberAccess) { + CompletionOnMemberAccess memberAccess = (CompletionOnMemberAccess) parser.assistNode; + if (!(memberAccess.receiver instanceof ThisReference)) { + // for these CompletionEngine uses a more specific position: + long position = memberAccess.nameSourcePosition; + start = (int) (position >>> 32); + end = (int) position; + } + } + chars = CharOperation.subarray(parser.scanner.source, start, end + 1); + } else { + if (parser.assistIdentifier() != null){ + if (((CompletionScanner)parser.scanner).completedIdentifierEnd + >= ((CompletionScanner)parser.scanner).completedIdentifierStart){ + chars = CharOperation.subarray( + parser.scanner.source, + ((CompletionScanner)parser.scanner).completedIdentifierStart, + ((CompletionScanner)parser.scanner).completedIdentifierEnd + 1); + } + } + } + computedReplacedSource = chars == null ? NONE : new String(chars); + } + assertEquals( + testName, + concatResults( + expectedCompletion, + expectedParentCompletion, + expectedUnitToString, + expectedCompletionIdentifier, + expectedReplacedSource), + concatResults(computedCompletion, + computedParentCompletion, + computedUnitToString, + computedCompletionIdentifier, + computedReplacedSource)); +} +private String concatResults( + String completionNode, + String parentCompletionNode, + String unitToString, + String completionIdentifier, + String replacedSource) { + StringBuilder buffer = new StringBuilder(); + buffer.append("### Completion node ###\n"); + buffer.append(completionNode); + buffer.append("\n### Parent completion node ###\n"); + buffer.append(parentCompletionNode); + buffer.append("\n### Completed identifier ###\n"); + buffer.append(completionIdentifier); + buffer.append("\n### Replaced source ###\n"); + buffer.append(replacedSource); + buffer.append("\n### Completed unit ###\n"); + buffer.append(unitToString); + return buffer.toString(); +} +/* + * Returns the method, the constructor or the type declaring the initializer + * at the cursor location in the given type. + * Returns null if not found. + */ +private ASTNode findMethod(TypeDeclaration type, int cursorLocation) { + if (type.methods != null) { + for (int i = 0; i < type.methods.length; i++) { + AbstractMethodDeclaration method = type.methods[i]; + if (method.declarationSourceStart <= cursorLocation && (cursorLocation <= method.declarationSourceEnd || method.declarationSourceEnd == 0)) { + return method; + } + } + } + if (type.memberTypes != null) { + for (int i = 0; i < type.memberTypes.length; i++) { + TypeDeclaration memberType = type.memberTypes[i]; + ASTNode method = findMethod(memberType, cursorLocation); + if (method != null) { + return method; + } + } + } + FieldDeclaration[] fields = type.fields; + if (fields != null) { + for (int i = 0; i < fields.length; i++) { + FieldDeclaration field = fields[i]; + if (field instanceof Initializer && field.declarationSourceStart <= cursorLocation && (cursorLocation <= field.declarationSourceEnd || field.declarationSourceEnd == 0)) { + return type; + } + } + } + return null; +} +/** + * Runs the given test that checks that diet completion parsing returns the given completion. + */ +protected void runTestCheckDietParse( + String compilationUnit, + String completeBehind, + String expectedCompletionNodeToString, + String expectedUnitDisplayString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + int cursorLocation = compilationUnit.indexOf(completeBehind) + completeBehind.length() - 1; + this.checkDietParse( + compilationUnit.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + expectedCompletionIdentifier, + expectedReplacedSource, + testName); +} +/** + * Runs the given test that checks that method completion parsing returns the given completion. + */ +protected void runTestCheckMethodParse( + String compilationUnit, + String completeBehind, + String expectedCompletionNodeToString, + String expectedUnitDisplayString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String[] expectedLabels, + String testName) { + + int completeBehindStart = compilationUnit.indexOf(completeBehind); + assertTrue("completeBehind string not found", completeBehindStart >= 0); + int cursorLocation = completeBehindStart + completeBehind.length() - 1; + this.checkMethodParse( + compilationUnit.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedUnitDisplayString, + expectedCompletionIdentifier, + expectedReplacedSource, + expectedLabels, + testName); +} +/** + * Runs the given test that checks that method completion parsing returns the given completion. + */ +protected void runTestCheckMethodParse( + String compilationUnit, + String completeBehind, + String expectedCompletionNodeToString, + String expectedUnitDisplayString, + String expectedCompletionIdentifier, + String expectedReplacedSource, + String testName) { + + this.runTestCheckMethodParse( + compilationUnit, + completeBehind, + expectedCompletionNodeToString, + expectedUnitDisplayString, + expectedCompletionIdentifier, + expectedReplacedSource, + null, + testName); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java new file mode 100644 index 0000000000..94a796db91 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSelectionTest.java @@ -0,0 +1,335 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 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.compiler.parser; + +import java.util.Locale; + +import org.eclipse.jdt.internal.codeassist.select.SelectionParser; +import org.eclipse.jdt.internal.codeassist.select.SelectionScanner; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.Block; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Initializer; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; + +public abstract class AbstractSelectionTest extends AbstractCompilerTest { + + public final static String NONE = ""; +public AbstractSelectionTest(String testName){ + super(testName); +} +/* + * DietParse with selectionNode check + */ +public void checkDietParse( + char[] source, + int selectionStart, + int selectionEnd, + String expectedSelection, + String expectedUnitToString, + String expectedSelectionIdentifier, + String expectedSelectedSource, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + SelectionParser parser = + new SelectionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault()))); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd); + + String computedUnitToString = unit.toString(); + //System.out.println(computedUnitToString); + //System.out.println(Util.displayString(computedUnitToString)); + //System.out.println(expectedUnitToString); + + String computedSelection = parser.assistNode == null + ? NONE + : parser.assistNode.toString(); + assertEquals( + "invalid selection node-" + testName, + expectedSelection, + computedSelection); + + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString, 2)); + } + assertEquals( + "invalid selection unit-" + testName, + expectedUnitToString, + computedUnitToString); + + if (expectedSelectionIdentifier != null){ + char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier; + String computedSelectionIdentifier = chars == null ? NONE : new String(chars); + assertEquals( + "invalid selection identifier-" + testName, + expectedSelectionIdentifier, + computedSelectionIdentifier); + } + if (expectedSelectedSource != null){ + char[] chars = null; + if (parser.assistNode != null){ + chars = CharOperation.subarray( + parser.scanner.source, + parser.assistNode.sourceStart, + parser.assistNode.sourceEnd + 1); + } else { + if (parser.assistIdentifier() != null){ + if (((SelectionScanner)parser.scanner).selectionEnd + >= ((SelectionScanner)parser.scanner).selectionStart){ + chars = CharOperation.subarray( + parser.scanner.source, + ((SelectionScanner)parser.scanner).selectionStart, + ((SelectionScanner)parser.scanner).selectionEnd + 1); + } + } + } + String computedSelectedSource = chars == null ? NONE : new String(chars); + assertEquals( + "invalid replaced source-" + testName, + expectedSelectedSource, + computedSelectedSource); + } +} +/* + * Parse a method with selectionNode check + */ +public void checkMethodParse( + char[] source, + int selectionStart, + int selectionEnd, + String expectedSelection, + String expectedUnitToString, + String expectedSelectionIdentifier, + String expectedSelectedSource, + String[] expectedLabels, + String testName) { + + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + SelectionParser parser = + new SelectionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault()))); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd); + + ASTNode foundMethod = null; + if (unit.types != null) { + for (int i = 0; i < unit.types.length; i++) { + TypeDeclaration type = unit.types[i]; + ASTNode method = findMethod(type, selectionStart); + if (method != null) { + foundMethod = method; + break; + } + } + } + assertTrue("no method found at cursor location", foundMethod != null); + if (foundMethod instanceof AbstractMethodDeclaration) { + parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit); + } else { + TypeDeclaration type = (TypeDeclaration)foundMethod; + FieldDeclaration[] fields = type.fields; + if (fields != null) { + for (int i = 0; i < fields.length; i++) { + FieldDeclaration field = fields[i]; + if (field instanceof Initializer && field.sourceStart <= selectionStart && selectionStart <= field.sourceEnd) { + parser.parseBlockStatements((Initializer)field, type, unit); + break; + } + } + } + } + + String computedUnitToString = unit.toString(); + //System.out.println(computedUnitToString); + //System.out.println(expectedUnitToString); + + String computedCompletion = parser.assistNode == null + ? NONE + : parser.assistNode.toString(); + assertEquals( + "invalid selection node-" + testName, + expectedSelection, + computedCompletion); + + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString, 2)); + } + assertEquals( + "invalid selection unit-"+testName, + expectedUnitToString, + computedUnitToString); + + if (expectedSelectionIdentifier != null){ + char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier; + String computedSelectionIdentifier = chars == null ? NONE : new String(chars); + assertEquals( + "invalid selection identifier-" + testName, + expectedSelectionIdentifier, + computedSelectionIdentifier); + } + if (expectedSelectedSource != null){ + char[] chars = null; + if (parser.assistNode != null){ + chars = CharOperation.subarray( + parser.scanner.source, + parser.assistNode.sourceStart, + parser.assistNode.sourceEnd + 1); + } else { + if (parser.assistIdentifier() != null){ + if (((SelectionScanner)parser.scanner).selectionEnd + >= ((SelectionScanner)parser.scanner).selectionStart){ + chars = CharOperation.subarray( + parser.scanner.source, + ((SelectionScanner)parser.scanner).selectionStart, + ((SelectionScanner)parser.scanner).selectionEnd + 1); + } + } + } + String computedReplacedSource = chars == null ? NONE : new String(chars); + assertEquals( + "invalid replaced source-" + testName, + expectedSelectedSource, + computedReplacedSource); + } + if (expectedLabels != null) { +/* + assert("no labels-" + testName, parser.labels != null); + int length = parser.labels.length; + assertEquals("invalid number of labels-" + testName, expectedLabels.length, length); + for (int i = 0; i < length; i++) { + String label = new String(parser.labels[i]); + assertEquals("invalid label-" + testName, expectedLabels[i], label); + } +*/ + } +} +/* + * Parse a method with selectionNode check + */ +public void checkMethodParse( + char[] source, + int selectionStart, + int selectionEnd, + String expectedSelection, + String expectedUnitToString, + String expectedSelectionIdentifier, + String expectedSelectedSource, + String testName) { + + this.checkMethodParse( + source, + selectionStart, + selectionEnd, + expectedSelection, + expectedUnitToString, + expectedSelectionIdentifier, + expectedSelectedSource, + null, + testName); +} +/* + * Returns the method, the constructor or the type declaring the initializer + * at the cursor location in the given type. + * Returns null if not found. + */ +protected ASTNode findMethod(TypeDeclaration type, int cursorLocation) { + if (type.methods != null) { + for (int i = 0; i < type.methods.length; i++) { + AbstractMethodDeclaration method = type.methods[i]; + if (method.declarationSourceStart <= cursorLocation && (cursorLocation <= method.declarationSourceEnd || method.declarationSourceEnd == 0)) { + return method; + } + } + } + if (type.memberTypes != null) { + for (int i = 0; i < type.memberTypes.length; i++) { + TypeDeclaration memberType = type.memberTypes[i]; + ASTNode method = findMethod(memberType, cursorLocation); + if (method != null) { + return method; + } + } + } + FieldDeclaration[] fields = type.fields; + if (fields != null) { + for (int i = 0; i < fields.length; i++) { + FieldDeclaration field = fields[i]; + if (field instanceof Initializer) { + Initializer initializer = (Initializer)field; + Block block = initializer.block; + if (block != null && block.sourceStart <= cursorLocation && (cursorLocation <= block.sourceEnd || block.sourceEnd == 0)) { + return type; + } + } + } + } + return null; +} +/** + * Runs the given test that checks that method completion parsing returns the given completion. + */ +protected void runTestCheckMethodParse( + String compilationUnit, + String selectionStartBehind, + String selectionEndBehind, + String expectedSelectionNodeToString, + String expectedUnitDisplayString, + String expectedSelectionIdentifier, + String expectedReplacedSource, + String testName) { + + int selectionStartBehindStart = compilationUnit.indexOf(selectionStartBehind); + assertTrue("selectionStartBehind string not found", selectionStartBehindStart != -1); + int selectionStart = selectionStartBehindStart + selectionStartBehind.length(); + int selectionEndBehindStart = compilationUnit.indexOf(selectionEndBehind); + assertTrue("selectionEndBehind string not found", selectionEndBehindStart != -1); + int selectionEnd = selectionEndBehindStart + selectionEndBehind.length() - 1; + + this.checkMethodParse( + compilationUnit.toCharArray(), + selectionStart, + selectionEnd, + expectedSelectionNodeToString, + expectedUnitDisplayString, + expectedSelectionIdentifier, + expectedReplacedSource, + testName); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java new file mode 100644 index 0000000000..c9cd046cee --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AbstractSyntaxTreeTest.java @@ -0,0 +1,489 @@ +/******************************************************************************* + * Copyright (c) 2012, 2020 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.compiler.parser; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.Locale; + +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; +import org.eclipse.jdt.internal.codeassist.select.SelectionParser; +import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.DocumentElementParser; +import org.eclipse.jdt.internal.compiler.IDocumentElementRequestor; +import org.eclipse.jdt.internal.compiler.ISourceElementRequestor; +import org.eclipse.jdt.internal.compiler.SourceElementParser; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Expression; +import org.eclipse.jdt.internal.compiler.ast.ImportReference; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblem; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.internal.core.search.indexing.IndexingParser; +import org.eclipse.jdt.internal.core.util.CommentRecorderParser; + +public class AbstractSyntaxTreeTest extends AbstractCompilerTest implements IDocumentElementRequestor, ISourceElementRequestor { + + protected static final int CHECK_PARSER = 0x1; + protected static final int CHECK_COMPLETION_PARSER = 0x2; + protected static final int CHECK_SELECTION_PARSER = 0x4; + protected static final int CHECK_DOCUMENT_ELEMENT_PARSER = 0x8; + protected static final int CHECK_COMMENT_RECORDER_PARSER = 0x10; + protected static final int CHECK_SOURCE_ELEMENT_PARSER = 0x20; + protected static final int CHECK_INDEXING_PARSER = 0x40; + protected static final int CHECK_JAVAC_PARSER = 0x80; + protected static int CHECK_ALL = (CHECK_PARSER | CHECK_COMPLETION_PARSER | CHECK_SELECTION_PARSER | + CHECK_DOCUMENT_ELEMENT_PARSER | CHECK_COMMENT_RECORDER_PARSER | + CHECK_SOURCE_ELEMENT_PARSER | CHECK_INDEXING_PARSER); + public static boolean optimizeStringLiterals = false; + private String referenceCompiler; + private String referenceCompilerTestsScratchArea; + + public AbstractSyntaxTreeTest(String name, String referenceCompiler, String referenceCompilerTestsScratchArea) { + super(name); + this.referenceCompiler = referenceCompiler; + this.referenceCompilerTestsScratchArea = referenceCompilerTestsScratchArea; + } + public void checkParse(int parserToCheck, char[] source, String expectedSyntaxErrorDiagnosis, + String testName, String expectedUnitToString, ASTVisitor visitor) throws IOException { + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + options.complianceLevel = ClassFileConstants.JDK1_8; + options.sourceLevel = ClassFileConstants.JDK1_8; + options.targetJDK = ClassFileConstants.JDK1_8; + checkParse(parserToCheck, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, visitor, options); + } + public void checkParse(int parserToCheck, char[] source, String expectedSyntaxErrorDiagnosis, + String testName, String expectedUnitToString, ASTVisitor visitor, CompilerOptions options) throws IOException { + + ICompilationUnit sourceUnit = null; + CompilationResult compilationResult = null; + CompilationUnitDeclaration unit = null; + + if (this.referenceCompiler != null && (parserToCheck & CHECK_JAVAC_PARSER) != 0) { + String javaFilePath = this.referenceCompilerTestsScratchArea + "\\Xyz.java"; + File f = new File(javaFilePath); + FileOutputStream o = new FileOutputStream(f); + OutputStreamWriter w = new OutputStreamWriter(o); + w.write(source); + w.close(); + Process p = Runtime.getRuntime().exec (new String[] { this.referenceCompiler, "-sourcepath", this.referenceCompilerTestsScratchArea, javaFilePath }, null, new File(this.referenceCompilerTestsScratchArea)); + try { + BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getInputStream())); + BufferedReader stderr = new BufferedReader(new InputStreamReader(p.getErrorStream())); + String line; + while ((line = stderr.readLine())!= null) + System.out.println(line); + while ((line = stdout.readLine())!= null) + System.out.println(line); + assertTrue("javac unhappy", p.waitFor() == 0); + } catch (InterruptedException e) { + System.err.println("Skipped javac behavior check due to interrupt..."); + } + } + if ((parserToCheck & CHECK_PARSER) != 0) { + Parser parser1 = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + sourceUnit = new CompilationUnit(source, testName, null); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser1.parse(sourceUnit, compilationResult); + parser1.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + if (visitor != null) { + unit.traverse(visitor, (CompilationUnitScope) null); + } + parser1 = null; + } + + if ((parserToCheck & CHECK_COMPLETION_PARSER) != 0) { + CompletionParser parser2 = new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser2.parse(sourceUnit, compilationResult, Integer.MAX_VALUE); + parser2.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + parser2 = null; + } + if ((parserToCheck & CHECK_SELECTION_PARSER) != 0) { + SelectionParser parser3 = new SelectionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault()))); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser3.parse(sourceUnit, compilationResult, Integer.MAX_VALUE, Integer.MAX_VALUE); + parser3.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + parser3 = null; + } + if ((parserToCheck & CHECK_DOCUMENT_ELEMENT_PARSER) != 0) { + DocumentElementParser parser4 = new DocumentElementParser( + this, + new DefaultProblemFactory(Locale.getDefault()), + options); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser4.parse(sourceUnit, compilationResult); + parser4.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + parser4 = null; + } + if ((parserToCheck & CHECK_COMMENT_RECORDER_PARSER) != 0) { + CommentRecorderParser parser5 = new CommentRecorderParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser5.parse(sourceUnit, compilationResult); + parser5.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + parser5 = null; + } + if ((parserToCheck & CHECK_SOURCE_ELEMENT_PARSER) != 0) { + SourceElementParser parser6 = new SourceElementParser(this, + new DefaultProblemFactory(Locale.getDefault()), + options, + true, + optimizeStringLiterals); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser6.parse(sourceUnit, compilationResult); + parser6.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + parser6 = null; + } + if ((parserToCheck & CHECK_INDEXING_PARSER) != 0) { + IndexingParser parser7 = new IndexingParser(this, + new DefaultProblemFactory(Locale.getDefault()), + options, + true, + optimizeStringLiterals, false); + compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + unit = parser7.parse(sourceUnit, compilationResult); + parser7.getMethodBodies(unit); + assertDianosticEquals(expectedSyntaxErrorDiagnosis, testName, compilationResult); + assertParseTreeEquals(expectedUnitToString, unit.toString()); + parser7 = null; + } + } + + public void checkParse(int parserToCheck, char[] source, String expectedSyntaxErrorDiagnosis, + String testName, String expectedUnitToString) throws IOException { + checkParse(parserToCheck, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, null); + } + + public void checkParse(char[] source, String expectedSyntaxErrorDiagnosis, String testName, String expectedUnitToString) + throws IOException { + checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString); + } + + public void checkParse(char[] source, String expectedSyntaxErrorDiagnosis, String testName, + String expectedUnitToString, ASTVisitor visitor) throws IOException { + checkParse(CHECK_ALL, source, expectedSyntaxErrorDiagnosis, testName, expectedUnitToString, visitor); + } + + private void assertParseTreeEquals(String expectedUnitToString, String computedUnitToString) { + if (expectedUnitToString == null) { // just checking that we are able to digest. + return; + } + if (!expectedUnitToString.equals(computedUnitToString)) { + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals("Parse Tree is wrong", + Util.convertToIndependantLineDelimiter(expectedUnitToString), + Util.convertToIndependantLineDelimiter(computedUnitToString)); + } + + private void assertDianosticEquals(String expectedSyntaxErrorDiagnosis, String testName, CompilationResult compilationResult) { + String computedSyntaxErrorDiagnosis = getCompilerMessages(compilationResult); + assertEquals( + "Invalid syntax error diagnosis" + testName, + Util.convertToIndependantLineDelimiter(expectedSyntaxErrorDiagnosis), + Util.convertToIndependantLineDelimiter(computedSyntaxErrorDiagnosis)); + } + + private String getCompilerMessages(CompilationResult compilationResult) { + StringBuilder buffer = new StringBuilder(100); + if (compilationResult.hasProblems() || compilationResult.hasTasks()) { + CategorizedProblem[] problems = compilationResult.getAllProblems(); + int count = problems.length; + int problemCount = 0; + char[] unitSource = compilationResult.compilationUnit.getContents(); + for (int i = 0; i < count; i++) { + if (problems[i] != null) { + if (problemCount == 0) + buffer.append("----------\n"); + problemCount++; + buffer.append(problemCount + (problems[i].isError() ? ". ERROR" : ". WARNING")); + buffer.append(" in " + new String(problems[i].getOriginatingFileName()).replace('/', '\\')); + try { + buffer.append(((DefaultProblem)problems[i]).errorReportSource(unitSource)); + buffer.append("\n"); + buffer.append(problems[i].getMessage()); + buffer.append("\n"); + } catch (Exception e) { + } + buffer.append("----------\n"); + } + } + } + String computedSyntaxErrorDiagnosis = buffer.toString(); + return computedSyntaxErrorDiagnosis; + } + + public void acceptImport(int declarationStart, int declarationEnd, int[] javaDocPositions, + char[] name, int nameStartPosition, boolean onDemand, int modifiers) { + + + } + + public void acceptInitializer(int declarationStart, int declarationEnd, int[] javaDocPositions, + int modifiers, int modifiersStart, int bodyStart, int bodyEnd) { + + + } + + public void acceptLineSeparatorPositions(int[] positions) { + + + } + + public void acceptPackage(int declarationStart, int declarationEnd, int[] javaDocPositions, + char[] name, int nameStartPosition) { + + + } + + public void acceptProblem(CategorizedProblem problem) { + + + } + + public void enterClass(int declarationStart, int[] javaDocPositions, int modifiers, + int modifiersStart, int classStart, char[] name, int nameStart, int nameEnd, + char[] superclass, int superclassStart, int superclassEnd, char[][] superinterfaces, int[] superinterfaceStarts, + int[] superinterfaceEnds, int bodyStart) { + + + } + + public void enterCompilationUnit() { + + + } + + public void enterConstructor(int declarationStart, int[] javaDocPositions, int modifiers, + int modifiersStart, char[] name, int nameStart, int nameEnd, char[][] parameterTypes, + int[] parameterTypeStarts, int[] parameterTypeEnds, char[][] parameterNames, int[] parameterNameStarts, int[] parameterNameEnds, + int parametersEnd, char[][] exceptionTypes, int[] exceptionTypeStarts, int[] exceptionTypeEnds, int bodyStart) { + + + } + + public void enterField(int declarationStart, int[] javaDocPositions, int modifiers, + int modifiersStart, char[] type, int typeStart, int typeEnd, int typeDimensionCount, + char[] name, int nameStart, int nameEnd, int extendedTypeDimensionCount, int extendedTypeDimensionEnd) { + + + } + + public void enterInterface(int declarationStart, int[] javaDocPositions, int modifiers, + int modifiersStart, int interfaceStart, char[] name, int nameStart, int nameEnd, + char[][] superinterfaces, int[] superinterfaceStarts, int[] superinterfaceEnds, int bodyStart) { + + + } + + public void enterMethod(int declarationStart, int[] javaDocPositions, int modifiers, + int modifiersStart, char[] returnType, int returnTypeStart, int returnTypeEnd, int returnTypeDimensionCount, + char[] name, int nameStart, int nameEnd, char[][] parameterTypes, int[] parameterTypeStarts, + int[] parameterTypeEnds, char[][] parameterNames, int[] parameterNameStarts, int[] parameterNameEnds, int parametersEnd, + int extendedReturnTypeDimensionCount, int extendedReturnTypeDimensionEnd, char[][] exceptionTypes, int[] exceptionTypeStarts, int[] exceptionTypeEnds, + int bodyStart) { + + + } + + public void exitClass(int bodyEnd, int declarationEnd) { + + + } + + public void exitCompilationUnit(int declarationEnd) { + + + } + + public void exitConstructor(int bodyEnd, int declarationEnd) { + + + } + + public void exitField(int bodyEnd, int declarationEnd) { + + + } + + public void exitInterface(int bodyEnd, int declarationEnd) { + + + } + + public void exitMethod(int bodyEnd, int declarationEnd) { + + + } + + public void acceptAnnotationTypeReference(char[][] annotation, int sourceStart, + int sourceEnd) { + + + } + + public void acceptAnnotationTypeReference(char[] annotation, int sourcePosition) { + + + } + + public void acceptConstructorReference(char[] typeName, int argCount, + int sourcePosition) { + + + } + + public void acceptFieldReference(char[] fieldName, int sourcePosition) { + + + } + + public void acceptImport(int declarationStart, int declarationEnd, int nameStart, + int nameEnd, char[][] tokens, boolean onDemand, int modifiers) { + + + } + + public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition) { + + + } + + public void acceptPackage(ImportReference importReference) { + + + } + + public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd) { + + + } + + public void acceptTypeReference(char[] typeName, int sourcePosition) { + + + } + + public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) { + + + } + + public void acceptUnknownReference(char[] name, int sourcePosition) { + + + } + + public void enterConstructor(MethodInfo methodInfo) { + + + } + + public void enterField(FieldInfo fieldInfo) { + + + } + + public void enterInitializer(int declarationStart, int modifiers) { + + + } + + public void enterMethod(MethodInfo methodInfo) { + + + } + + public void enterType(TypeInfo typeInfo) { + + + } + + public void exitConstructor(int declarationEnd) { + + + } + + public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) { + + + } + + public void exitInitializer(int declarationEnd) { + + + } + + public void exitMethod(int declarationEnd, Expression defaultValue) { + + + } + + public void exitType(int declarationEnd) { + + + } + @Override + public void exitRecordComponent(int declarationEnd, int declarationSourceEnd) { + + } + +} \ No newline at end of file diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java new file mode 100644 index 0000000000..30694438a4 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java @@ -0,0 +1,343 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.compiler.parser; + +import junit.framework.Test; + +/** + * Completion is expected to be an AllocationExpression. + */ +public class AllocationExpressionCompletionTest extends AbstractCompletionTest { +public AllocationExpressionCompletionTest(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(AllocationExpressionCompletionTest.class); +} +/* + * Completion inside an if statement. + */ +public void testInIfStatement1() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " if (true) { \n" + + " new z.y.X(1, 2, i); \n" + + " } \n" + + " } \n" + + "}\n", + // completeBehind: + "X(", + // expectedCompletionNodeToString: + ", 2, i)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " if (true)\n" + + " {\n" + + " , 2, i)>;\n" + + " }\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "new z.y.X(1, 2, i)", + // test name + "" + ); +} +public void testInIfStatement2() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " if (true) { \n" + + " new z.y.X(1, 2, i); \n" + + " } \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " if (true)\n" + + " {\n" + + " new z.y.X(1, 2, , i);\n" + + " }\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a constructor invocation with no qualification and using a qualified type name. + * + * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt + * where ClassType is a qualified type name + */ +public void testNoQualificationQualifiedTypeName1() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " new z.y.X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " ;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +public void testNoQualificationQualifiedTypeName2() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " new z.y.X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " new z.y.X(1, 2, , i);\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a constructor invocation with no qualification and using a simple type name. + * + * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt + * where ClassType is a simple type name + */ +public void testNoQualificationSimpleTypeName1() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " ;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +public void testNoQualificationSimpleTypeName2() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " new X(1, 2, , i);\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a constructor invocation qualified with a name. + * + * ie. ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt + */ +public void testQualifiedWithName1() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar {\n" + + " void foo() { \n" + + " Buz.x.new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(", + // expectedCompletionNodeToString: + ", 2, i)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " , 2, i)>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "Buz.x.new X(1, 2, i)", + // test name + "" + ); +} +public void testQualifiedWithName2() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar {\n" + + " void foo() { \n" + + " Buz.x.new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " Buz.x.new X(1, 2, , i);\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a constructor invocation qualified with a primary. + * + * ie. ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt + */ +public void testQualifiedWithPrimary1() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " primary().new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(", + // expectedCompletionNodeToString: + ", 2, i)>", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " , 2, i)>;\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "primary().new X(1, 2, i)", + // test name + "" + ); +} +public void testQualifiedWithPrimary2() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " void foo() { \n" + + " primary().new X(1, 2, i); \n" + + " } \n" + + "}\n", + // completeBehind: + "X(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " }\n" + + " void foo() {\n" + + " primary().new X(1, 2, , i);\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java new file mode 100644 index 0000000000..ab78e15829 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationCompletionParserTest.java @@ -0,0 +1,5147 @@ +/******************************************************************************* + * Copyright (c) 2000, 2014 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.compiler.parser; + + +import java.util.Map; + +import junit.framework.Test; + +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; + + + +@SuppressWarnings({ "unchecked", "rawtypes" }) +public class AnnotationCompletionParserTest extends AbstractCompletionTest { +static { + //TESTS_NAMES= new String[]{"test0087"}; +} + +public AnnotationCompletionParserTest(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(AnnotationCompletionParserTest.class); +} + +@Override +protected Map getCompilerOptions() { + Map options = super.getCompilerOptions(); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + return options; +} + +public void test0001(){ + String str = + "public @MyAnn class X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0002(){ + String str = + "public @MyAnn interface X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0003(){ + String str = + "public @MyAnn enum X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "enum X {\n" + + " X() {\n" + + " }\n" + + " () {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0004(){ + String str = + "public @MyAnn @interface X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "@interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0005(){ + String str = + "public @MyAnn class X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0006(){ + String str = + "public @MyAnn interface X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0007(){ + String str = + "public @MyAnn enum X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "enum X {\n" + + " X() {\n" + + " }\n" + + " () {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0008(){ + String str = + "public @MyAnn @interface X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "@interface X {\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0009(){ + String str = + "public @MyAnn\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0010(){ + String str = + "public class X {\n" + + " public @MyAnn class Y {\n" + + " }\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0011(){ + String str = + "public class X {\n" + + " public @MyAnn class Y\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @\n" + + " class Y {\n" + + " Y() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0012(){ + String str = + "public class X {\n" + + " public @MyAnn\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0013_Diet(){ + String str = + "public class X {\n" + + " public void foo() {\n" + + " @MyAnn class Y {\n" + + " }\n" + + " }\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0013_Method(){ + String str = + "public class X {\n" + + " public void foo() {\n" + + " @MyAnn class Y {\n" + + " }\n" + + " }\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo() {\n" + + " @\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0014(){ + String str = + "public @MyAnn(ZORK) class X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0015(){ + String str = + "public @MyAnn(ZORK) class X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0016(){ + String str = + "public @MyAnn(ZORK)\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0017(){ + String str = + "public @MyAnn(v1=\"\", v2=\"\") class X {\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0018(){ + String str = + "public @MyAnn(v1=\"\", v2=\"\")) class X\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n" + + "class X {\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0019(){ + String str = + "public @MyAnn(v1=\"\", v2=\"\")\n" + + ""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0020(){ + String str = + "public @MyAnn(v1=\"\""; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "@\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0021(){ + String str = + "public class X {\n" + + " @MyAnn void foo() {}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0022(){ + String str = + "public class X {\n" + + " @MyAnn int var;\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0023(){ + String str = + "public class X {\n" + + " void foo(@MyAnn int i) {}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " @\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0024_Diet(){ + String str = + "public class X {\n" + + " void foo() {@MyAnn int i}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0024_Method(){ + String str = + "public class X {\n" + + " void foo() {@MyAnn int i}\n" + + "}"; + + + String completeBehind = "MyAnn"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "MyAnn"; + String expectedReplacedSource = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " @\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0025(){ + String str = + "@Annot(foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot()\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0026(){ + String str = + "public class X {\n" + + " @Annot(foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0027(){ + String str = + "public class X {\n" + + " @Annot(foo)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0028_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0028_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0029_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0029_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0030(){ + String str = + "public class X {\n" + + " @Annot(foo)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0031(){ + String str = + "@Annot(foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot()\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0032(){ + String str = + "public class X {\n" + + " @Annot(foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0033(){ + String str = + "public class X {\n" + + " @Annot(foo\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0034_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0034_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0035_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0035_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0036(){ + String str = + "public class X {\n" + + " @Annot(foo\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0037(){ + String str = + "@Annot(foo=zzz)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot()\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0038(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0039(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0040_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0040_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0041_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0041_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0042(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0043(){ + String str = + "@Annot(foo=zzz\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot()\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0044(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0045(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0046_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0046_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0047_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0047_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot()\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0048(){ + String str = + "public class X {\n" + + " @Annot(foo=zzz\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot()"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot()\n" + + " public X() {\n" + + " }\n" + + " zzz X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0049(){ + String str = + "@Annot(yyy=zzz,foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0050(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0051(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0052_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0052_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0053_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0053_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0054(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0055(){ + String str = + "@Annot(yyy=zzz,foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0056(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0057(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0058_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0058_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0059_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0059_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0060(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0061(){ + String str = + "@Annot(yyy=zzz,foo=zzz)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0062(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0063(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0064_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0064_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0065_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0065_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz) int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0066(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz)\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0067(){ + String str = + "@Annot(yyy=zzz,foo=zzz\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(yyy = zzz,)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0068(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0069(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " int var;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " int var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0070_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0070_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0071_Diet(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0071_Method(){ + String str = + "public class X {\n" + + " void bar(int var1, @Annot(yyy=zzz,foo=zzz int var2) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(int var1) {\n" + + " @Annot(yyy = zzz,)\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0072(){ + String str = + "public class X {\n" + + " @Annot(yyy=zzz,foo=zzz\n" + + " X() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(yyy = zzz,)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(yyy = zzz,)\n" + + " public X() {\n" + + " }\n" + + " zzz X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0073(){ + String str = + "@Annot(zzz=yyy,f)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "f"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = yyy,)"; + String completionIdentifier = "f"; + String expectedReplacedSource = "f"; + String expectedUnitDisplayString = + "@Annot(zzz = yyy,)\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0074(){ + String str = + "@Annot(zzz=foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = ) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0075(){ + String str = + "@Annot(zzz= a && foo)\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = (a && )) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0076(){ + String str = + "@Annot(zzz= {foo})\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = {})\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0078(){ + String str = + "@Annot(zzz= {yyy, foo})\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = {})\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0079(){ + String str = + "@Annot(zzz=foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = )\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0080(){ + String str = + "@Annot(zzz= a && foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = (a && ))\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0081(){ + String str = + "@Annot(zzz= {yyy, foo}\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = {})\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0082(){ + String str = + "@Annot(zzz= {yyy, foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = {})\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0083(){ + String str = + "@Annot(zzz= a && (b || (foo && c)))\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "( && c)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public @Annot(zzz = (a && (b || ( && c)))) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0084(){ + String str = + "@Annot(zzz= a && (b || (foo\n" + + "public class X {\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "@Annot(zzz = )\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0085(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = ) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0086(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo)\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = (a && )) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0087(){ + String str = + "public class X {\n" + + " @Annot(zzz= {foo})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0088(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n"+ + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0089(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = )\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0090(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && ))\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0091(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0092(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0093(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "( && c)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @Annot(zzz = (a && (b || ( && c)))) void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0094(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = )\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0095(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo)\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = ) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0096(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo)\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && )) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0097(){ + String str = + "public class X {\n" + + " @Annot(zzz= {foo})\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0098(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0099(){ + String str = + "public class X {\n" + + " @Annot(zzz=foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = )\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0100(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && ))\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0101(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0102(){ + String str = + "public class X {\n" + + " @Annot(zzz= {yyy, foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = {})\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0103(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "( && c)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = (a && (b || ( && c)))) int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0104(){ + String str = + "public class X {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " int bar;\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " @Annot(zzz = )\n" + + " int bar;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0105_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0105_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = )\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0106_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0106_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && foo)\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = (a && ))\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0107_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0107_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = {})\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0108_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0108_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo})\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = {})\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0109_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0109_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz=foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = )\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0110_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " int var;\n" + + " @Annot(zzz= a && foo\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0110_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " int var;\n" + + " @Annot(zzz= a && foo\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " int var;\n" + + " @Annot(zzz = (a && ))\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0111_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0111_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo}\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = {})\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0112_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0112_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= {yyy, foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = {})\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0113_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0113_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo && c)))\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = )\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0114_Diet(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = ""; + String expectedReplacedSource = ""; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0114_Method(){ + String str = + "public class X {\n" + + " void bar() {\n" + + " @Annot(zzz= a && (b || (foo\n" + + " int var;\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = )\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0115(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz=foo) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = ) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0116(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && foo) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = (a && )) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0117(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {foo}) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0118(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {yyy, foo}) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0119_Diet(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz=foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0119_Method(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz=foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "zzz = "; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = )\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0120_Diet(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0120_Method(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "(a && )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " @Annot(zzz = (a && ))\n" + + " }\n" + + "}\n"; + + checkMethodParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "full ast"); +} +public void test0121(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {yyy, foo} int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0122(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= {yyy, foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0123(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && (b || (foo && c))) int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "( && c)"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar(@Annot(zzz = (a && (b || ( && c)))) int var) {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0124(){ + String str = + "public class X {\n" + + " void bar(@Annot(zzz= a && (b || (foo int var) {\n" + + " }\n" + + "}"; + + + String completeBehind = "foo"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = "@Annot(zzz = )"; + String completionIdentifier = "foo"; + String expectedReplacedSource = "foo"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=148742 +public void test0125(){ + String str = + "public interface X {\n" + + " public void test(@TestAnnotation int testParam);\n" + + "}"; + + + String completeBehind = "@TestAnnotation"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "TestAnnotation"; + String expectedReplacedSource = "TestAnnotation"; + String expectedUnitDisplayString = + "public interface X {\n" + + " @\n" + + " public void test() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148742 +public void test0126(){ + String str = + "public abstract class X {\n" + + " public abstract void test(@TestAnnotation int testParam);\n" + + "}"; + + + String completeBehind = "@TestAnnotation"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = "@"; + String expectedParentNodeToString = ""; + String completionIdentifier = "TestAnnotation"; + String expectedReplacedSource = "TestAnnotation"; + String expectedUnitDisplayString = + "public abstract class X {\n" + + " @\n" + + " public X() {\n" + + " }\n" + + " public abstract void test();\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0127(){ + String str = + "public class Test {\n" + + " public static final int zzint = 0;\n" + + " @ZZAnnotation({ZZ})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "{ZZ"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "ZZ"; + String expectedReplacedSource = "ZZ"; + String expectedUnitDisplayString = + "public class Test {\n" + + " @ZZAnnotation(value = {})\n" + + " public static final int zzint;\n" + + " public Test() {\n" + + " }\n" + + " () {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0128(){ + String str = + "public class Test {\n" + + " public static final int zzint = 0;\n" + + " @ZZAnnotation(value={ZZ})\n" + + " void bar() {\n" + + " }\n" + + "}"; + + + String completeBehind = "{ZZ"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "ZZ"; + String expectedReplacedSource = "ZZ"; + String expectedUnitDisplayString = + "public class Test {\n" + + " @ZZAnnotation(value = {})\n" + + " public static final int zzint;\n" + + " public Test() {\n" + + " }\n" + + " () {\n" + + " }\n" + + " void bar() {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +public void test0129(){ + String str = + "public class Test {\n" + + " public static final int zzint = 0;\n" + + " @ZZAnnotation({ZZ\n" + + "}"; + + + String completeBehind = "{ZZ"; + int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; + String expectedCompletionNodeToString = ""; + String expectedParentNodeToString = ""; + String completionIdentifier = "ZZ"; + String expectedReplacedSource = "ZZ"; + String expectedUnitDisplayString = + "public class Test {\n" + + " @ZZAnnotation(value = {})\n" + + " public static final int zzint;\n" + + " public Test() {\n" + + " }\n" + + " () {\n" + + " }\n" + + "}\n"; + + checkDietParse( + str.toCharArray(), + cursorLocation, + expectedCompletionNodeToString, + expectedParentNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + "diet ast"); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java new file mode 100644 index 0000000000..40589f6b45 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationDietRecoveryTest.java @@ -0,0 +1,1972 @@ +/******************************************************************************* + * Copyright (c) 2000, 2014 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.compiler.parser; + +import java.util.Locale; +import java.util.Map; + +import junit.framework.Test; + +import org.eclipse.jdt.core.tests.util.AbstractCompilerTest; +import org.eclipse.jdt.core.tests.util.Util; +import org.eclipse.jdt.internal.codeassist.complete.CompletionParser; +import org.eclipse.jdt.internal.compiler.CompilationResult; +import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; +import org.eclipse.jdt.internal.compiler.SourceElementParser; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; +import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; + +// This test suite test the first implementation of the annotation recovery. +// Tests must be updated with annotation recovery improvment +// TODO(david) update test suite +@SuppressWarnings({ "unchecked", "rawtypes" }) +public class AnnotationDietRecoveryTest extends AbstractCompilerTest { + private static final boolean CHECK_ALL_PARSE = true; + public static boolean optimizeStringLiterals = false; + public static long sourceLevel = ClassFileConstants.JDK1_3; //$NON-NLS-1$ + +public AnnotationDietRecoveryTest(String testName){ + super(testName); +} +public static Test suite() { + return buildMinimalComplianceTestSuite(testClass(), F_1_5); +} +public static Class testClass() { + return AnnotationDietRecoveryTest.class; +} +/* + * Toggle compiler in mode -1.5 + */ +@Override +protected Map getCompilerOptions() { + Map options = super.getCompilerOptions(); + options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); + options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5); + return options; +} + +public void checkParse( + char[] source, + String expectedDietUnitToString, + String expectedDietPlusBodyUnitToString, + String expectedFullUnitToString, + String expectedCompletionDietUnitToString, + String testName) { + + /* using regular parser in DIET mode */ + if (CHECK_ALL_PARSE){ + Parser parser = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid unit diet structure" + testName, + expectedDietUnitToString, + computedUnitToString); + } + /* using regular parser in DIET mode + getMethodBodies */ + { + Parser parser = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid unit diet structure" + testName, + expectedDietUnitToString, + computedUnitToString); + if (computedUnit.types != null) { + for (int i = 0, length = computedUnit.types.length; i < length; i++){ + computedUnit.types[i].parseMethods(parser, computedUnit); + } + } + computedUnitToString = computedUnit.toString(); + if (!expectedDietPlusBodyUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + + assertEquals( + "Invalid unit diet+body structure" + testName, + expectedDietPlusBodyUnitToString, + computedUnitToString); + } + /* using regular parser in FULL mode */ + if (CHECK_ALL_PARSE){ + Parser parser = + new Parser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + new CompilerOptions(getCompilerOptions()), + new DefaultProblemFactory(Locale.getDefault())), + optimizeStringLiterals); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.parse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedFullUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid unit full structure" + testName, + expectedFullUnitToString, + computedUnitToString); + + } + /* using source element parser in DIET mode */ + if (CHECK_ALL_PARSE){ + SourceElementParser parser = + new SourceElementParser( + new TestSourceElementRequestor(), + new DefaultProblemFactory(Locale.getDefault()), + new CompilerOptions(getCompilerOptions()), + false/*don't record local declarations*/, + true/*optimize string literals*/); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid source element diet structure" + testName, + expectedDietUnitToString, + computedUnitToString); + } + /* using source element parser in FULL mode */ + if (CHECK_ALL_PARSE){ + SourceElementParser parser = + new SourceElementParser( + new TestSourceElementRequestor(), + new DefaultProblemFactory(Locale.getDefault()), + new CompilerOptions(getCompilerOptions()), + false/*don't record local declarations*/, + true/*optimize string literals*/); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.parse(sourceUnit, compilationResult); + String computedUnitToString = computedUnit.toString(); + if (!expectedFullUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid source element full structure" + testName, + expectedFullUnitToString, + computedUnitToString); + } + /* using completion parser in DIET mode */ + if (CHECK_ALL_PARSE){ + CompilerOptions options = new CompilerOptions(getCompilerOptions()); + CompletionParser parser = + new CompletionParser( + new ProblemReporter( + DefaultErrorHandlingPolicies.proceedWithAllProblems(), + options, + new DefaultProblemFactory(Locale.getDefault())), + false); + + ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); + CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); + + CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, Integer.MAX_VALUE); + String computedUnitToString = computedUnit.toString(); + if (!expectedCompletionDietUnitToString.equals(computedUnitToString)){ + System.out.println(Util.displayString(computedUnitToString)); + } + assertEquals( + "Invalid completion diet structure" + testName, + expectedCompletionDietUnitToString, + computedUnitToString); + } +} + +public void test0001() { + + String s = + "package a; \n" + + "public @interface X \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0002() { + + String s = + "package a; \n" + + "public @interface X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0003() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo() \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() {\n" + +" }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0004() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo() default \"blabla\" \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() default \"blabla\" {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +/* + * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79770 + */ +public void test0005() { + + String s = + "@Documented \n" + + "@Rentention(RententionPolicy.RUNTIME) \n" + + "@Target(ElementType.TYPE) \n" + + "@interface MyAnn { \n" + + " String value() default \"Default Message\" \n" + + "} \n" + + "public class X { \n" + + " public @MyAnn void something() { } \n" + + "} \n"; + + String expectedDietUnitToString = + "@Documented @Rentention(RententionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface MyAnn {\n" + + " String value() default \"Default Message\" {\n" + + " }\n" + + "}\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @MyAnn void something() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "@Documented @Rentention(RententionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface MyAnn {\n" + + " String value() default \"Default Message\" {\n" + + " }\n" + + "}\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " public @MyAnn void something() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0006() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo() {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0007() { + + String s = + "package a; \n" + + "public @interface X { \n" + + " String foo( \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @interface X {\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + expectedDietUnitToString; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0008() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int var1, @Annot(at1=zzz, at2) int var2 { \n" + + " } \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0009() { + + String s = + "package a; \n" + + "public class X { \n" + + " @SuppressWarnings(\"unchecked\");\n" + + " List l; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @SuppressWarnings(\"unchecked\") List l;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @SuppressWarnings(\"unchecked\") List l;\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " List l;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +public void test0010() { + + String s = + "package a; \n" + + "public class X { \n" + + " String foo() { \n" + + " @interface Y { \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @interface Y {\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @interface Y {\n" + + " }\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " String foo() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=176725 +public void test0011() { + + String s = + "package a; \n" + + "public class X { \n" + + " # \n" + + " @AnAnnotation({var}) \n" + + " public void foo() { \n" + + " } \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @AnAnnotation({var}) void foo() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " public @AnAnnotation({var}) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=210404 +public void test0012() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int var1, @Annot(at1=zzz, at2=@Annot(at3=zzz, at4)) int var2 { \n" + + " } \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int var1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0013() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietPlusBodyUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0014() { + + String s = + "package a; \n" + + "# \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0015() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "# \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0016() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2) \n" + + "# \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0017() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "# \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0018() { + + String s = + "package a; \n" + + "@AnAnnotation(name=) \n" + + "@AnAnnotation2(name2) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public @AnAnnotation2(name2) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0019() { + + String s = + "package a; \n" + + "@AnAnnotation(name) \n" + + "@AnAnnotation2(name2=) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2 = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name) @AnAnnotation2(name2 = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0020() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name) # \n" + + " int field; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name) int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name) int field;\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0021() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name=) \n" + + " int field; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name = $missing$) int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " @AnAnnotation(name = $missing$) int field;\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " int field;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0022() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name) # \n" + + " void foo() {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @AnAnnotation(name) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " @AnAnnotation(name) void foo() {\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0023() { + + String s = + "package a; \n" + + "public class X { \n" + + " @AnAnnotation(name=) \n" + + " void foo() {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " @AnAnnotation(name = $missing$) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " @AnAnnotation(name = $missing$) void foo() {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0024() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int param1, @AnAnnotation(name) # int param2) {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0025() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int param1, @AnAnnotation(name=) int param2) {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0026() { + + String s = + "package a; \n" + + "public class X { \n" + + " void foo(int param1, @AnAnnotation(@AnAnnotation1(name1=\"a\", name2=) int param2) {} \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + " void foo(int param1) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + expectedDietUnitToString; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0027() { + + String s = + "package a; \n" + + "@AnAnnotation1(name1=\"a\", #) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0028() { + + String s = + "package a; \n" + + "@AnAnnotation1(name1=\"a\", name2=@AnAnnotation2(name3=\"b\"), #) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\",name2 = @AnAnnotation2(name3 = \"b\")) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name1 = \"a\",name2 = @AnAnnotation2(name3 = \"b\")) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0030() { + + String s = + "package a; \n" + + "@AnAnnotation1(\"a\"#) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0031() { + + String s = + "package a; \n" + + "@AnAnnotation1(\"a\", name2=@AnAnnotation2(name3=\"b\"), #) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0032() { + + String s = + "package a; \n" + + "@AnAnnotation1(\"a\", name2=@AnAnnotation2(name3=\"b\")) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(\"a\") @AnAnnotation2(name3 = \"b\") class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0033() { + + String s = + "package a; \n" + + "@AnAnnotation1(name=new Object() {}) # \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0034() { + + String s = + "package a; \n" + + "@AnAnnotation1(name=new Object() {},#) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = new Object() {\n" + + "}) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130778 +public void test0035() { + + String s = + "package a; \n" + + "@AnAnnotation1(name=new Object() {#}) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation1(name = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=227855 +public void test0036() { + + String s = + "package a; \n" + + "# \n" + + "public class Test { \n" + + " public Test() {} \n" + + " @SuppressWarnings(value=\"\") \n" + + " private int id; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class Test {\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=227855 +public void test0037() { + + String s = + "package a; \n" + + "# \n" + + "public class Test { \n" + + " public int id0; \n" + + " @SuppressWarnings(value=\"\") \n" + + " private int id; \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " public int id0;\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public class Test {\n" + + " public int id0;\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class Test {\n" + + " public int id0;\n" + + " private @SuppressWarnings(value = \"\") int id;\n" + + " public Test() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464 +public void test0038() { + + String s = + "package a; \n" + + "@AnAnnotation(name=) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464 +public void test0039() { + + String s = + "package a; \n" + + "@AnAnnotation(name1=a,name2=) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464 +public void test0040() { + + String s = + "package a; \n" + + "@AnAnnotation(name1=a,name2=,name3=c) \n" + + "public class X { \n" + + "} \n"; + + String expectedDietUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + + String expectedDietPlusBodyUnitToString = + "package a;\n" + + "public @AnAnnotation(name1 = a,name2 = $missing$) class X {\n" + + " public X() {\n" + + " super();\n" + + " }\n" + + "}\n"; + + + String expectedFullUnitToString = + expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package a;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=366003 +public void test0041() { + + String s = + "package snippet;\n" + + "public class Bug366003 {\n" + + " void foo(Object o1){}\n" + + " @Blah org.User(@Bla String str){}\n" + + "}\n"; + + String expectedDietUnitToString = + "package snippet;\n" + + "public class Bug366003 {\n" + + " public Bug366003() {\n" + + " }\n" + + " void foo(Object o1) {\n" + + " }\n" + + " @Blah User(@Bla String str) {\n" + + " }\n" + + "}\n"; + + String expectedDietPlusBodyUnitToString = + "package snippet;\n" + + "public class Bug366003 {\n" + + " public Bug366003() {\n" + + " super();\n" + + " }\n" + + " void foo(Object o1) {\n" + + " }\n" + + " @Blah User(@Bla String str) {\n" + + " }\n" + + "}\n"; + + String expectedFullUnitToString = expectedDietUnitToString; + + String expectedCompletionDietUnitToString = + "package snippet;\n" + + "public class Bug366003 {\n" + + " public Bug366003() {\n" + + " }\n" + + " void foo(Object o1) {\n" + + " }\n" + + " User(@Bla String str) {\n" + + " }\n" + + "}\n"; + + String testName = ""; + checkParse( + s.toCharArray(), + expectedDietUnitToString, + expectedDietPlusBodyUnitToString, + expectedFullUnitToString, + expectedCompletionDietUnitToString, + testName); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java new file mode 100644 index 0000000000..f2d45adae6 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/AnnotationSelectionTest.java @@ -0,0 +1,645 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.compiler.parser; + +public class AnnotationSelectionTest extends AbstractSelectionTest { +public AnnotationSelectionTest(String testName) { + super(testName); +} +/* + * Selection at specific location + */ +public void test0001() { + + String str = + "public @MyAnn class X { \n" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @ class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0003() { + + String str = + "public @MyAnn.ZZ class X { \n" + + "} \n"; + + String selection = "ZZ"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "ZZ"; + String expectedUnitDisplayString = + "public @ class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn.ZZ"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +//TODO enable this test when selection parser support this test case +public void _test0005() { + + String str = + "public @MyAnn.ZZ" + + " \n"; + + String selection = "ZZ"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "ZZ"; + String expectedUnitDisplayString = + "public @ class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn.ZZ"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0007() { + + String str = + "public class X {" + + " public @MyAnn void foo(" + + " " + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public @ void foo() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0009() { + + String str = + "public class X {" + + " public @MyAnn Object var" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public @ Object var;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0011() { + + String str = + "public class X {" + + " public @MyAnn class Y {" + + " }" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public class X {\n" + + " public @ class Y {\n" + + " public Y() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0013() { + + String str = + "public @MyAnn() class X {" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @() class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0015() { + + String str = + "public @MyAnn(value = \"\") class X {" + + "} \n"; + + String selection = "MyAnn"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "MyAnn"; + String expectedUnitDisplayString = + "public @(value = \"\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "MyAnn"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0017() { + + String str = + "public @MyAnn(value1 = \"\", value2 = \"\") class X {" + + "} \n"; + + String selection = "value1"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "value1"; + String expectedUnitDisplayString = + "public @MyAnn(,value2 = \"\") class X {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "value1"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java new file mode 100644 index 0000000000..2d89e672e6 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java @@ -0,0 +1,388 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 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.compiler.parser; + +import junit.framework.Test; + +/** + * Completion is expected to be an ExplicitConstructorInvocation + * or inside an ExplicitConstructorInvocation + */ +public class ExplicitConstructorInvocationCompletionTest extends AbstractCompletionTest { +public ExplicitConstructorInvocationCompletionTest(String testName) { + super(testName); +} +public static Test suite() { + return buildAllCompliancesTestSuite(ExplicitConstructorInvocationCompletionTest.class); +} +/* + * Completion on a qualified 'super' constructor invocation. + * + * ie. ExplicitConstructorInvocation ::= Primary '.' 'super' '(' ArgumentListopt ')' ';' + */ +public void testPrimarySuper() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar(Bar x) { \n" + + " primary().super(1, 2, i); \n" + + " } \n" + + " } \n" + + "} \n", + // completeBehind: + "super(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar(Bar x) {\n" + + " primary().super(1, 2, , i);\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a qualified 'this' constructor invocation. + * + * ie. ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ArgumentListopt ')' ';' + */ +public void testPrimaryThis() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar(Bar x) { \n" + + " primary().this(1, 2, i); \n" + + " } \n" + + " } \n" + + "} \n", + // completeBehind: + "this(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar(Bar x) {\n" + + " primary().this(1, 2, , i);\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a 'super' constructor invocation. + * + * ie. ExplicitConstructorInvocation ::= 'super' '(' ArgumentListopt ')' ';' + */ +public void testSuper() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " Bar() { \n" + + " super(1, 2, i); \n" + + " } \n" + + "} \n", + // completeBehind: + "super(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " super(1, 2, , i);\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * Completion on a 'this' constructor invocation. + * + * ie. ExplicitConstructorInvocation ::= 'this' '(' ArgumentListopt ')' ';' + */ +public void testThis() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " Bar() { \n" + + " this(1, 2, i); \n" + + " } \n" + + "} \n", + // completeBehind: + "this(1, 2,", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " this(1, 2, , i);\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "", + // expectedReplacedSource: + "", + // test name + "" + ); +} +/* + * ExplicitConstructorInvocation ::= Name '.' 'super' '(' ')' ';' + */ +public void testWrapperNameSuper() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar() { \n" + + " Bar.super(fred().xyz); \n" + + " } \n" + + " } \n" + + "} \n", + // completeBehind: + "fred().x", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar() {\n" + + " Bar.super();\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "x", + // expectedReplacedSource: + "xyz", + // test name + "" + ); +} +/* + * ExplicitConstructorInvocation ::= Name '.' 'this' '(' ')' ';' + */ +public void testWrapperNameThis() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar() { \n" + + " Bar.this(fred().xyz); \n" + + " } \n" + + " } \n" + + "} \n", + // completeBehind: + "fred().x", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar() {\n" + + " Bar.this();\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "x", + // expectedReplacedSource: + "xyz", + // test name + "" + ); +} +/* + * ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ')' ';' + */ +public void testWrapperPrimarySuper() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar(Bar x) { \n" + + " primary().super(fred().xyz); \n" + + " } \n" + + " } \n" + + "} \n", + // completeBehind: + "fred().x", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar(Bar x) {\n" + + " primary().super();\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "x", + // expectedReplacedSource: + "xyz", + // test name + "" + ); +} +/* + * ExplicitConstructorInvocation ::= 'super' '(' ')' ';' + */ +public void testWrapperSuper() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " Bar() { \n" + + " super(fred().xyz); \n" + + " } \n" + + "} \n", + // completeBehind: + "x", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " super();\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "x", + // expectedReplacedSource: + "xyz", + // test name + "" + ); +} +/* + * ExplicitConstructorInvocation ::= 'this' '(' ')' ';' + */ +public void testWrapperThis() { + this.runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " Bar() { \n" + + " this(fred().xyz); \n" + + " } \n" + + "} \n", + // completeBehind: + "x", + // expectedCompletionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " this();\n" + + " }\n" + + "}\n", + // expectedCompletionIdentifier: + "x", + // expectedReplacedSource: + "xyz", + // test name + "" + ); +} +} diff --git a/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java new file mode 100644 index 0000000000..d9ec20d873 --- /dev/null +++ b/jdt-patch/e425/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java @@ -0,0 +1,232 @@ +/******************************************************************************* + * Copyright (c) 2000, 2016 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.compiler.parser; + +/** + * Selection is expected to be wrapped with an explicit constructor invocation. + */ +public class ExplicitConstructorInvocationSelectionTest extends AbstractSelectionTest { +public ExplicitConstructorInvocationSelectionTest(String testName) { + super(testName); +} +/* + * ExplicitConstructorInvocation ::= Name '.' 'super' '(' ')' ';' + */ +public void testNameSuper() { + runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar() { \n" + + " Bar.super(fred()); \n" + + " } \n" + + " } \n" + + "} \n", + // selectionStartBehind: + "Bar.super(", + // selectionEndBehind: + "fred", + // expectedSelectionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar() {\n" + + " Bar.super();\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedSelectionIdentifier: + "fred", + // expectedReplacedSource: + "fred()", + // testName: + "" + ); +} +/* + * ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ')' ';' + */ +public void testPrimarySuper() { + runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " static Bar x; \n" + + " public class InnerBar { \n" + + " InnerBar(Bar x) { \n" + + " } \n" + + " } \n" + + " public class SubInnerBar extends InnerBar { \n" + + " SubInnerBar(Bar x) { \n" + + " primary().super(fred()); \n" + + " } \n" + + " } \n" + + "} \n", + // selectionStartBehind: + "super(", + // selectionEndBehind: + "fred", + // expectedSelectionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " public class InnerBar {\n" + + " InnerBar(Bar x) {\n" + + " }\n" + + " }\n" + + " public class SubInnerBar extends InnerBar {\n" + + " SubInnerBar(Bar x) {\n" + + " primary().super();\n" + + " }\n" + + " }\n" + + " static Bar x;\n" + + " () {\n" + + " }\n" + + " Bar() {\n" + + " }\n" + + "}\n", + // expectedSelectionIdentifier: + "fred", + // expectedReplacedSource: + "fred()", + // testName: + "" + ); +} +/* + * ExplicitConstructorInvocation ::= 'this' '(' ')' ';' + */ +public void testThis() { + runTestCheckMethodParse( + // compilationUnit: + "class Bar { \n" + + " Bar() { \n" + + " this(fred()); \n" + + " } \n" + + "} \n", + // selectionStartBehind: + "this(", + // selectionEndBehind: + "fred", + // expectedSelectionNodeToString: + "", + // expectedUnitDisplayString: + "class Bar {\n" + + " Bar() {\n" + + " this();\n" + + " }\n" + + "}\n", + // expectedSelectionIdentifier: + "fred", + // expectedReplacedSource: + "fred()", + // testName: + ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0002() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ">"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " > z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0004() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Y.Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ">"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " > z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0006() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Y.Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ".Z>"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " .Z> z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection at specific location + */ +public void test0008() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Y.Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ".Z>"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " .Z> z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection of simple name + */ +public void test0010() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ">"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " > z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection of qualified name + */ +public void test0012() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Y.Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ">"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " > z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection of qualified name + */ +public void test0014() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Y.Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ".Z>"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " .Z> z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection of qualified name + */ +public void test0016() { + + String str = + "public class X { \n" + + " void foo(){; \n" + + " Y.Z z; \n" + + " } \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ".Z>"; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " .Z> z;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void test0018() { + + String str = + "public class X { \n" + + " public X() { \n" + + " } \n" + + " void foo(){; \n" + + " new X(); \n" + + " } \n" + + "} \n"; + + String selection = "X"; + + String expectedCompletionNodeToString = "X()>"; + + String completionIdentifier = "X"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " X()>;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "new X()"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void test0020() { + + String str = + "public class X { \n" + + " public class Inner { \n" + + " public Inner() { \n" + + " } \n" + + " } \n" + + " void foo(X x){; \n" + + " x.new Inner(); \n" + + " } \n" + + "} \n"; + + String selection = "Inner"; + + String expectedCompletionNodeToString = "Inner()>"; + + String completionIdentifier = "Inner"; + String expectedUnitDisplayString = + "public class X {\n" + + " public class Inner {\n" + + " public Inner() {\n" + + " }\n" + + " }\n" + + " public X() {\n" + + " }\n" + + " void foo(X x) {\n" + + " Inner()>;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "x.new Inner()"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Selection of simple name + */ +public void test0022() { + + String str = + "public class X { \n" + + " Y.Z z; \n" + + "} \n"; + + String selection = "Z"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "Z"; + String expectedUnitDisplayString = + "public class X {\n" + + " z;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Y.Z"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=255142 +public void test0024() { + + String str = + "import java.util.List;\n" + + "public class X {\n" + + " T bar(T t) { return t; }\n" + + " void foo(boolean b, Runnable r) {\n" + + " Zork z = null;\n" + + " String s = (String) bar(z); // 5\n" + + " }\n" + + "}\n" + + "\n"; + + String selection = "bar"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "bar"; + String expectedUnitDisplayString = + "import java.util.List;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " T bar(T t) {\n" + + " }\n" + + " void foo(boolean b, Runnable r) {\n" + + " Zork z;\n" + + " String s = (String) ;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "bar(z)"; + String testName = ""; + + int selectionStart = string.indexOf(selection); + int selectionEnd = selectionStart + selection.length() - 1; + + this.checkDietParse( + string.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=424110, [1.8][hovering] Hover, F3 does not work for method reference in method invocation +public void test424110a() throws JavaModelException { + String string = + "public class X {\n" + + " int i = fun(X::m); // [2] Does not work\n" + + " public static int m(int x) {\n" + + " return x;\n" + + " }\n" + + " private int fun(F f) {\n" + + " return f.foo(0);\n" + + " }\n" + + "}\n" + + "interface F {\n" + + " int foo(int x);\n" + + "}\n"; + + String selection = "m"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "m"; + String expectedUnitDisplayString = + "public class X {\n" + + " int i = fun();\n" + + " public X() {\n" + + " }\n" + + " public static int m(int x) {\n" + + " }\n" + + " private int fun(F f) {\n" + + " }\n" + + "}\n" + + "interface F {\n" + + " int foo(int x);\n" + + "}\n"; + String expectedReplacedSource = "X::m"; + String testName = ""; + + int selectionStart = string.indexOf(selection); + int selectionEnd = selectionStart + selection.length() - 1; + + this.checkDietParse( + string.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=476693 +public void test476693() throws JavaModelException { + String string = + "import static java.util.stream.Collectors.toList;\n" + + "import java.util.List;\n" + + "import java.util.Spliterator;\n" + + "import java.util.stream.Stream;\n" + + "interface Seq extends Stream, Iterable {\n" + + " @Override\n" + + " default Spliterator spliterator() {\n" + + " return Iterable.super.spliterator();\n" + + " }\n" + + "}\n" + + "interface Tuple2 {}\n" + + "interface Tuple3 {}\n" + + "\n" + + "public class Test {\n" + + " Seq> m(Stream arg1, Stream arg2) {\n" + + " System.out.println(\"m1\"); return null;\n" + + " }\n" + + " Seq> m(Seq arg1, Seq arg2){\n" + + " System.out.println(\"m3\"); return null;\n" + + " }\n" + + " void m(Seq c1, Seq c2, Seq c3) {\n" + + " // Click F3 on the m() call. This will jump to m1, erroneously\n" + + " List> l = m(c1, c2).collect(toList());\n" + + " System.out.println(\"Hello\"); // This shouldn't appear in the selection parse tree\n" + + " }\n" + + "}"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "m"; + String expectedUnitDisplayString = + "import static java.util.stream.Collectors.toList;\n" + + "import java.util.List;\n" + + "import java.util.Spliterator;\n" + + "import java.util.stream.Stream;\n" + + "interface Seq extends Stream, Iterable {\n" + + " default @Override Spliterator spliterator() {\n" + + " }\n" + + "}\n" + + "interface Tuple2 {\n" + + "}\n" + + "interface Tuple3 {\n" + + "}\n" + + "public class Test {\n" + + " public Test() {\n" + + " }\n" + + " Seq> m(Stream arg1, Stream arg2) {\n" + + " }\n" + + " Seq> m(Seq arg1, Seq arg2) {\n" + + " }\n" + + " void m(Seq c1, Seq c2, Seq c3) {\n" + + " List> l = .collect(toList());\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "m(c1, c2)"; + String testName = ""; + + int selectionStart = string.indexOf("byteValue"); + int selectionEnd = selectionStart + completionIdentifier.length() - 1; + + this.checkMethodParse( + string.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +public void test495912a() { + String string = + "package xy;\n" + + "public class Test {\n" + + " {\n" + + " Runnable r = () -> {\n" + + " Integer i= 1;\n" + + " byte b= i.byteValue();\n" + + " if (true) {\n" + + " if (false) {\n" + + " }\n" + + " }\n" + + " for (int i1 = 0; i1 < 42; i1++) {\n" + + " }\n" + + " };\n" + + " }\n" + + " public void foo(Runnable r) {\n" + + " }\n" + + "}"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "byteValue"; + String expectedUnitDisplayString = + "package xy;\n" + + "public class Test {\n" + + " {\n" + + " {\n" + + " Runnable r = () -> {\n" + + " Integer i;\n" + + " byte b = ;\n" + + " if (true)\n" + + " {\n" + + " if (false)\n" + + " {\n" + + " }\n" + + " }\n" + + " for (int i1;; (i1 < 42); i1 ++) \n" + + " {\n" + + " }\n" + + " };\n" + + " }\n" + + " }\n" + + " public Test() {\n" + + " }\n" + + " public void foo(Runnable r) {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "i.byteValue()"; + String testName = ""; + + int selectionStart = string.indexOf("getTransientData"); + int selectionEnd = selectionStart + selectionIdentifier.length() - 1; + + this.checkMethodParse( + string.toCharArray(), + selectionStart, + selectionEnd, + expectedSelectionNodeToString, + expectedUnitDisplayString, + selectionIdentifier, + expectedReplacedSource, + testName); +} +public void testBug486264_selectionOnLambda_expectLambdaMethod() { + String string = + "package xy;\n" + + "import java.util.stream.*;\n" + + "public class Lambda {\n" + + " public static void foo() {\n" + + " Stream.of(\"1\").filter(t -> t.length() > 1).collect(Collectors.toList());\n" + + " }\n" + + " \n" + + "}\n"; + + String expectedSelectionNodeToString = " t) -> (t.length() > 1))>"; + + String selectionIdentifier = "t -> t.length() > 1"; + String expectedUnitDisplayString = + "package xy;\n" + + "import java.util.stream.*;\n" + + "public class Lambda {\n" + + " public Lambda() {\n" + + " }\n" + + " public static void foo() {\n" + + " Stream.of(\"1\").filter( t) -> (t.length() > 1))>).collect(Collectors.toList());\n" + + " }\n" + + "}\n" + + ""; + String expectedReplacedSource = "t -> t.length() > 1"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select superinterface + */ +public void test02() { + + String str = + "import java.io.*; \n" + + " \n" + + "public class X extends IOException implements Serializable { \n" + + " int foo(){} \n" + + "} \n"; + + String selectionStartBehind = "implements "; + String selectionEndBehind = "Serializable"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "Serializable"; + String expectedUnitDisplayString = + "import java.io.*;\n" + + "public class X extends IOException implements {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Serializable"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select package from qualified superclass + */ +public void test04() { + + String str = + "public class X extends java.io.IOException { \n" + + "} \n"; + + String selectionStartBehind = "java."; + String selectionEndBehind = "java.io"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "io"; + String expectedUnitDisplayString = + "public class X extends {\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "java.io.IOException"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select message send with recovery before + */ +public void test06() { + + String str = + "public class X extends \n" + + " int foo(){ \n" + + " System.out.println(\"hello\"); \n"; + + String selectionStartBehind = "System.out."; + String selectionEndBehind = "println"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "println"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " ;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "System.out.println(\"hello\")"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select field reference + */ +public void test08() { + + String str = + "public class X { \n" + + " int num = 0; \n" + + " int foo(){ \n" + + " int j = this.num; \n" + + "} \n"; + + String selectionStartBehind = "this."; + String selectionEndBehind = "this.num"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "num"; + String expectedUnitDisplayString = + "public class X {\n" + + " int num;\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " int j = ;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "this.num"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select field reference inside message receiver + */ +public void test10() { + + String str = + "public class X { \n" + + " X x; \n" + + " int foo(){ \n" + + " int j = this.x.foo(); \n" + + "} \n"; + + String selectionStartBehind = "this."; + String selectionEndBehind = "this.x"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "x"; + String expectedUnitDisplayString = + "public class X {\n" + + " X x;\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " int j = ;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "this.x"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select qualified allocation + */ +public void test12() { + + String str = + "public class X { \n" + + " class Y { \n" + + " Y(int i){} \n" + + " } \n" + + " X(int i){} \n" + + " int foo(){ \n" + + " int j = 0; \n" + + " X x = new X(j); \n" + + " x.new Y(1); \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "x.new "; + String selectionEndBehind = "x.new Y"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "Y"; + String expectedUnitDisplayString = + "public class X {\n" + + " class Y {\n" + + " Y(int i) {\n" + + " }\n" + + " }\n" + + " X(int i) {\n" + + " }\n" + + " int foo() {\n" + + " int j;\n" + + " X x;\n" + + " ;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "x.new Y(1)"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select qualified name reference + */ +public void test14() { + + String str = + "public class X { \n" + + " int foo(){ \n" + + " System sys = java.lang.System; \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "java.lang."; + String selectionEndBehind = "java.lang.System"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "System"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " System sys = ;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "java.lang.System"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select variable type + */ +public void test16() { + + String str = + "public class X { \n" + + " int foo(){ \n" + + " System sys = null; \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "\n "; + String selectionEndBehind = "\n System"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "System"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " sys;\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "System"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select anonymous type + */ +public void test18() { + + String str = + "public class X { \n" + + " int foo(){ \n" + + " new Object(){ \n" + + " int bar(){} \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "new "; + String selectionEndBehind = "new Object"; + + String expectedCompletionNodeToString = + ""; + String completionIdentifier = "Object"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " ;\n" + + " }\n" + + "}\n"; + + String expectedReplacedSource = "new Object()"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select package + */ +public void test20() { + + String str = + "package x.y.other; \n" + + "public class X { \n" + + " int foo(){ \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "x."; + String selectionEndBehind = "x.y"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "y"; + String expectedUnitDisplayString = + "package ;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " }\n" + + "}\n"; + + String expectedReplacedSource = "x.y.other"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select import on demand + */ +public void test22() { + + String str = + "import x.y.other.*; \n" + + "public class X { \n" + + " int foo(){ \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "y."; + String selectionEndBehind = "y.other"; + + String expectedCompletionNodeToString = ""; + String completionIdentifier = "other"; + String expectedUnitDisplayString = + "import ;\n" + + "public class X {\n" + + " public X() {\n" + + " }\n" + + " int foo() {\n" + + " }\n" + + "}\n"; + + String expectedReplacedSource = "x.y.other"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select nested type superclass with syntax error behind + */ +public void test24() { + + String str = + "public class G { \n" + + " void foo() { \n" + + " class X { \n" + + " class Y extends G { \n" + + " int foo() \n" + + " } \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "extends "; + String selectionEndBehind = "extends G"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "G"; + String expectedUnitDisplayString = + "public class G {\n" + + " public G() {\n" + + " }\n" + + " void foo() {\n" + + " class X {\n" + + " class Y extends {\n" + + " Y() {\n" + + " }\n" + + " int foo() {\n" + + " }\n" + + " }\n" + + " X() {\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + + String expectedReplacedSource = "G"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select qualified super + */ +public void test26() { + + String str = + "public class G { \n" + + " Object foo() { \n" + + " new X(){ \n" + + " Object bar(){ \n" + + " return G.super.foo(); \n" + + " } \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "G."; + String selectionEndBehind = "G.super"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "super"; + String expectedUnitDisplayString = + "public class G {\n" + + " public G() {\n" + + " }\n" + + " Object foo() {\n" + + " new X() {\n" + + " Object bar() {\n" + + " return ;\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "G.super"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select qualified super constructor call + */ +public void test28() { + + String str = + "public class G { \n" + + " class M {} \n" + + " static Object foo() { \n" + + " class X extends M { \n" + + " X (){ \n" + + " new G().super(); \n" + + " } \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "new G()."; + String selectionEndBehind = "new G().super"; + + String expectedCompletionNodeToString = ";"; + + String completionIdentifier = "super"; + String expectedUnitDisplayString = + "public class G {\n" + + " class M {\n" + + " M() {\n" + + " }\n" + + " }\n" + + " public G() {\n" + + " }\n" + + " static Object foo() {\n" + + " class X extends M {\n" + + " X() {\n" + + " ;\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "new G().super()"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select super constructor call with arguments + */ +public void test30() { + + String str = + "public class G { \n" + + " G() { \n" + + " super(new G()); \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "\n\t\t"; + String selectionEndBehind = "super"; + + String expectedCompletionNodeToString = ";"; + + String completionIdentifier = "super"; + String expectedUnitDisplayString = + "public class G {\n" + + " G() {\n" + + " ;\n" + + " }\n" + + "}\n"; + + String expectedReplacedSource = "super(new G())"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} + +/* + * Select qualified this constructor call + */ +public void test36() { + + String str = + "public class G { \n" + + " static Object foo() { \n" + + " class X { \n" + + " X (){ \n" + + " } \n" + + " X (int x){ \n" + + " new G().this(); \n" + + " } \n" + + " } \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "new G()."; + String selectionEndBehind = "new G().this"; + + String expectedCompletionNodeToString = ";"; + + String completionIdentifier = "this"; + String expectedUnitDisplayString = + "public class G {\n" + + " public G() {\n" + + " }\n" + + " static Object foo() {\n" + + " class X {\n" + + " X() {\n" + + " super();\n"+ + " }\n" + + " X(int x) {\n" + + " ;\n" + + " }\n" + + " }\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "new G().this()"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * Select this constructor call with arguments + */ +public void test38() { + + String str = + "public class G { \n" + + " G() { \n" + + " this(new G()); \n" + + " } \n" + + "} \n"; + + String selectionStartBehind = "\n\t\t"; + String selectionEndBehind = "this"; + + String expectedCompletionNodeToString = ";"; + + String completionIdentifier = "this"; + String expectedUnitDisplayString = + "public class G {\n" + + " G() {\n" + + " ;\n" + + " }\n" + + "}\n"; + + String expectedReplacedSource = "this(new G())"; + String testName = ""; + + int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); + int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} + +/* + * bugs 3229 OpenOnSelection - strange behaviour of code resolve (1GAVL08) + */ +public void test40() { + + String str = + "public class X { \n" + + " Object \n" + + "} \n"; + + String selection = "Object"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "Object"; + String expectedUnitDisplayString = + "public class X {\n" + + " ;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Object"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * bugs 11475 selection on argument name. + */ +public void test42() { + + String str = + "public class X { \n" + + " public void foo(Object var){ \n" + + " } \n" + + "} \n"; + + String selection = "var"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "var"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " public void foo() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "var"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * bugs 15430 + */ +public void test44() { + + String str = + "public class X { \n" + + " String x = super.foo() \n" + + "} \n"; + + String selection = "super"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "super"; + String expectedUnitDisplayString = + "public class X {\n" + + " String x = ;\n" + + " public X() {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "super"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} + +/* + * bugs 14468 + */ +public void test46() { + + String str = + "public class X { \n" + + " void foo() {\n" + + " y = x instanceof Object;\n" + + " } \n" + + "} \n"; + + String selection = "Object"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "Object"; + String expectedUnitDisplayString = + "public class X {\n"+ + " public X() {\n"+ + " }\n"+ + " void foo() {\n"+ + " y = (x instanceof );\n"+ + " }\n"+ + "}\n"; + String expectedReplacedSource = "Object"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * bugs 14468 + */ +public void test48() { + + String str = + "public class X { \n" + + " boolean y = x instanceof Object;\n" + + "} \n"; + + String selection = "Object"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "Object"; + String expectedUnitDisplayString = + "public class X {\n"+ + " boolean y = (x instanceof );\n"+ + " public X() {\n"+ + " }\n"+ + "}\n"; + String expectedReplacedSource = "Object"; + String testName = ""; + + int selectionStart = str.lastIndexOf(selection); + int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; + + checkDietParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=52422 + */ +public void test50() { + + String str = + "public class X { \n" + + " void foo() {\n" + + " new Object(){\n" + + " void bar(){\n" + + " bar2();\n" + + " }\n" + + " void bar2() {\n" + + " }\n" + + " }\n" + + " } \n" + + "} \n"; + + String selection = "bar2"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "bar2"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " new Object() {\n" + + " void bar() {\n" + + " ;\n" + + " }\n" + + " void bar2() {\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "bar2()"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +/* + * bugs https://bugs.eclipse.org/bugs/show_bug.cgi?id=52422 + */ +public void test52() { + + String str = + "public class X { \n" + + " void foo() {\n" + + " new Object(){\n" + + " void foo0(){\n" + + " new Object(){\n" + + " void bar(){\n" + + " bar2();\n" + + " }\n" + + + " }\n" + + " }\n" + + " void bar2() {\n" + + " }\n" + + " }\n" + + " }\n" + + "} \n"; + + String selection = "bar2"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "bar2"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " new Object() {\n" + + " void foo0() {\n" + + " new Object() {\n" + + " void bar() {\n" + + " ;\n" + + " }\n" + + " };\n" + + " }\n" + + " void bar2() {\n" + + " }\n" + + " };\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "bar2()"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +//https://bugs.eclipse.org/bugs/show_bug.cgi?id=84001 +public void test54() { + + String str = + "public class X { \n" + + " void foo() {\n" + + " new Test.Sub();\n" + + " }\n" + + "} \n"; + + String selection = "Test"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "Test"; + String expectedUnitDisplayString = + "public class X {\n" + + " public X() {\n" + + " }\n" + + " void foo() {\n" + + " new ();\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "Test"; + String testName = ""; + + int selectionStart = str.indexOf(selection); + int selectionEnd = str.indexOf(selection) + selection.length() - 1; + + this.checkMethodParse( + str.toCharArray(), + selectionStart, + selectionEnd, + expectedCompletionNodeToString, + expectedUnitDisplayString, + completionIdentifier, + expectedReplacedSource, + testName); +} +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=291040 +public void _test56() { + + String str = + "class X {\n" + + " void foo() {\n" + + " new X(null) {\n" + + " void goo() {\n" + + " new X(zoo()) {\n" + + " void voo() {\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " Object zoo() {\n" + + " return null;\n" + + " }\n" + + " };\n" + + " }\n" + + "\n" + + " X(Object k) {\n" + + " }\n" + + "}\n"; + + String selection = "zoo"; + + String expectedCompletionNodeToString = ""; + + String completionIdentifier = "zoo"; + String expectedUnitDisplayString = + "class X {\n" + + " void foo() {\n" + + " new X(null) {\n" + + " void goo() {\n" + + " new X() {\n" + + " void voo() {\n" + + " }\n" + + " };\n" + + " }\n" + + " Object zoo() {\n" + + " }\n" + + " };\n" + + " }\n" + + " X(Object k) {\n" + + " }\n" + + "}\n"; + String expectedReplacedSource = "zoo()"; + String testName = "